Is there UISwitch settings control in Android like iOS - android

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.

Related

preference activity UI for settings

I'm beginner in android , now I'm building an android application. .
I'm working in setting screen now and in my research i have seen so many applications that is using preference activity for the settings.So i started my setting page using preference activity. But in my case , my application settings have some options that don't need to save as preference. And that are also connecting with server and the EditTextPreference dialog will be also different. So i got confused in this case.
So what should i do? Do i have to change this to a LinearLayout?
Please help
The preference compat fragment and activity is there to make it simple to create an interface and save it to SharePreference. but you can't change much of the thing. I believe the sharepreference compat and component is itself has the listener when is changing. So let it save to preference even if you don't need it probably Ok. Also if your mockup or design for EditTextPreference is look different from native android then You can try use theme and style to change the look and feel of EditText just for preference only.
Also, You probably can use scrollview + constrainlayout or linearlayout to build it but you're make extra work such as save/load to/from preference, UI like sub preference ...etc. I would sugguest to go with Theme and Style but if your UI is completely different and can't be adapted with Preference then it left no choice. Constraint Layout would be better than LinearLayout.
The PreferenceFragment attached to a preference activity is the ideal way to have a settings screen. You will however need to implement the PreferenceChangeListener in the PreferenceFragment to listen for preference changes and save the changes. If you have options that do not need to be saved you can still add them to the xml and make them disabled by setting android:enabled = false.
EditTextPreferences can have their own UI feel by using the android:theme = #style/yourstyle and specifying the style you want in your styles.xml file
Goodluck.

Android control widget layout

I'm trying to make a widget which is a togglebutton like the ones in the android control widget (the quicksettings for wlan, bluetooth etc.).
Here's how it looks (#Control Widgets)
Does anyone know if this layout is contained in the android sdk or if not how I can make a layout just like that one?
I've already tried some things but I don't know how do to the stroke at the bottom.
Regarding to your issue I searched a little bit deeper.
See: https://developer.android.com/guide/topics/appwidgets/index.html
These are the classes which you can use with an appwidget to implement in your layout there is no such thing like a toggle button, but an imagebutton which I think us exactly what Google is using for the "toggle buttons". Take a closer look on the imagebutton :
https://developer.android.com/reference/android/widget/ImageButton.html
Then you will find out it's exactly what you are looking for.
By default, an ImageButton looks like a regularButton, with the standard button background that changes color during different button states. The image on the surface of the button is defined either by the android:src attribute in the XML element or by thesetImageResource(int) method.
I can't imagine that such a complex layout is possible just using clean xml...
Hope it helps now!

Android Settings app preference files

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).

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

How to set a layout using spinner

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.

Categories

Resources