Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a settings page looking like in native app

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.

like image 261
jslachta Avatar asked Oct 17 '18 08:10

jslachta


People also ask

What should your app include in settings?

The ideal groups could be 'General, Account, Notifications, Appearance, Privacy, Help & Support, and About.

What is application setting?

Application settings enables developers to save state in their application using very little custom code, and is a replacement for dynamic properties in previous versions of the . NET Framework.


1 Answers

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}

like image 107
Martinedo Avatar answered Oct 24 '22 19:10

Martinedo