I want to create a ListActivity that has both checkboxs and single selection groups. Like in the Sound Settins in the "Settings" application of android.
Anyone has link to a sample ?
To make a "settings" Activity you should use the Preferences framework. Check this small tutorial: you have to create a special layout and make a reference from code like this:
addPreferencesFromResource(R.xml.preferences);
Related
I need to make an Activity that will replace the PreferenceActivity. The reason is that we need to save the settings in the SQL. I need a way to style my settings screen to look exactly like the PreferencesActivity. Can someone give me a link to the code of the PreferenceActivity layout code on Android AOSP? or maybe how can I achieve that?
I've read Android's settings tutorial, and want to use the new "headers" feature in order to accomplish something like the left image. To be exact, I want to have a global "enabled" checkbox, and below it some preference headers surrounded with a category header.
Can I make it be just by using XMLs ?
Yes it is possible by writing your own adapter class that handles headers. I found this nice pretty straightforward example for native settings looking like preference.
It's working on handset but it's not fixed for tablet (app crashes as it tries to use two-pane layout).
I took a look at the preference activity that Android use for settings. i'm looking for something like UISwitch as shown in below image, does Android have one like this.
I can see the nearest control on Android preference settings is "list preference"
There is ToggleButton and CompoundButton (one extends the other).
But those have a different default display widget then what you are looking for. However either could be used along with your own drawable resources to create the "switch" type control that you are after.
But by default no the system does not include a widget that serves this function and looks the way you want it to.
No, In Android its called ToggleButton.
But still it can be developed by extending RadioButton placed in RadioGroup and giving its UI way you wanted.
I'd like to create a 'settings' tab in my Android application which will look like views in Android's system settings - for example like a Phone settings > Sound.
I'd like to achieve that headers, checkbox/radio list elements but I have no idea how to bite that.
When I create that UI elements in my XML definition of UI, they does not looks well.
Please suggest me a correct way to do that ane provide me some examples.
The magic word to search is preference
A random link to set you up : http://www.kaloer.com/android-preferences
I want to create a layout like the below picture. How can I set the drop-down like this with cancel option. I am using spinner to show the drop-down but cannot set the layout like this.
Can anyone help me to create a drop-down like this. I also want to create an expand button for a list item which will open the content in a new page. My aim is to set all the available settings in a single page.
Then use PreferenceActivity. In fact, that's a standard preference screen.
http://developer.android.com/reference/android/preference/PreferenceScreen.html
http://jetpad.org/2011/01/creating-a-preference-activity-in-android/
You can take a look at the API Demo app which is in the Android SDK. There you can learn how to create this kind of screens (either from XML or code). It has many advantages... for instance, you won't have to worry about persisting the settings... the OS will do that for you.