5

I would like to create settings page which would look like the settings on native platform (eg. PreferenceActivity/Fragment with xml on Android).

I am used to design the settings page by creating simple preference xml on Android which handles the basic settings flawlessly, however I am unable to find the similar mechanism in Xamarin.Forms which would do the same thing for all platforms natively (with the gui part). I just only found the SettingsPlugin which handles "Create and access settings from shared code across all of your apps!".

https://github.com/jamesmontemagno/SettingsPlugin

I would really appreciate any recommendation on designing the settings pages.

1 Answer 1

12

You can use a TableView, which is an original Xamarin Forms User interface (without any plugin). If you set his Intent="Settings" , you can display a nice list of configuration settings like SwitchCell, EntryCell, or a CustomCell.

Displaying these elements depend on the operating system and on the version of it. So it looks and feels different on f.e. Android 4.4 and different on Android 8.

For example:

<TableView Intent="Settings">
    <TableRoot>
        <TableSection Title="My settings">
            <EntryCell Label="Name:" Placeholder="Enter Your First Name Here"/>
            <SwitchCell Text="Show my name" On="true"/>
            <SwitchCell Text="Update app automatically"/>
        </TableSection>
    </TableRoot>
</TableView>

Which will render something (not exactly that) like this: {source of img}

8
  • 1
    Thank you! That fits my needs :-)
    – nestor10
    Oct 17, 2018 at 14:13
  • Can you get it that it saves these settings automatically ? Oct 10, 2019 at 21:39
  • @rogue39nin save where? if you mean as app setting use Preferences. Its easy and simple. learn.microsoft.com/en-us/xamarin/essentials/…
    – Martinedo
    Oct 11, 2019 at 11:14
  • Yes but i was wanting it to appear in the actually settings coag of andriod @Martinedo Oct 11, 2019 at 21:31
  • How can I change the heading of the settings?
    – paraJdox1
    Jan 17, 2020 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.