Creating a standard Android preferences dialog - android

New Android developer here - I'm hoping this is simple.
I want to create a "row-based" prefs dialog, like you see in most standard apps. You know, black background, fading-line separators, bigger/bold label text for each entry, smaller description text, perhaps a checkbox/down arrow.
Is there a standard object in the Android API for this? If not, how do people usually create these?

Yes, there is a special Activity for that kind of view called PreferenceActivity.
You can find a full example here.
HTH
Thomas
EDIT: this example is a code based preference dialog, but there is another way to do with the xml layout file.

Related

Is there UISwitch settings control in Android like iOS

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.

Android Dropdown List (iPhone style)

Could anyone tell me either what this widget is or how it could be recreated? I'm having to port over a iPhone app, and my boss wants me to make it look as similar as possible, but while using android controls. Here is a picture of it in Android:
http://cdn3.staztic.com/screenshots/android-swim-32-2.jpg
Thanks!
It is not a standard thing, but for this purpose, there is a: QuickAction dialog.
this can be done with a PopupWindow (it can also be shown as dropdown) where the background is a custom nine-patch file and the content is a listview (or any other view that fits your needs).
I'm sure that GreenDroid Library can do this but I don't know the name of the class to use

Android - Is it possible to change a property specifically for each ListPreference entry?

I have an ordinary Android ListPreference defined in my code -
<ListPreference
android:title="Font"
android:summary="Choose the font of the reader"
android:key="fontList"
android:entries="#array/fonts"
android:entryValues="#array/fontValues">
</ListPreference>
It gives a list of a couple of different font types that the user can pick from, nothing special. What I wondering is, is there a way to set each list item's font to the font that it displays? This would be a nice feature as it would allow the user to see what they have to pick from before having to test it out.
I can't see any obvious way of doing it, or at least a way that wouldn't destroy the nice default UI.
Any help would be appreciated.
The best way to do it would be to extend the ListPreference class and implement your own preference. From memory I think you need to override the onCreateDialogView, onBindDialogView, onSetInitialValue and onDialogClosed methods. Best place to look is at the List Preference page on developer.android.com
like he said for fonts u will need custom one. But what I found that there are alot of different default android:theme="#android:style/Theme....."
try the once that are available ... there are 9-10 of them.
maybe u will get somewhat closer to what u need that extending your own custom UI.

Creating 'settings' view equivalent to the system views

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

Text Picker Component

Does something exist for Android? I am looking for something equivalent to HTML's tag. I see things like NumberPicker, but I can't see any way to have a basic drop down selector.
I am aware of ListPreference, but I want to use it outside the context of a PreferenceActivity and inside arbitrary views. Anyone?
Are you looking for the spinner, maybe?

Categories

Resources