Android Spinner with "Radio Buttons" and Cancel button - android

I am looking for some guidance on how to develop the following spinner dialog shown below in the screen shot. It is present in your your android phone's Settings->Display-> Font Size option.
I have been able to implement a spinner with a simple CheckedTextView for each row.
But I am looking to develop something more specific as shown below.
I have searched all over the place for custom spinners.. but most of the show me how to add images etc to each item in the dropdown.. but nothing specific like this... where I have to "pre select" an item based on what is already chosen.
Some questions I am grappling with are....
1) Are those simple radio buttons beside a text view?
2) How would I know which item to "set selected" when I open the spinner dialog? Because my code would reside in my adapter, where my spinner would be in my Activity/Fragment.
3) How would I put a cancal button in a spinner dialog which dismisses it?
Thanks.

I had created a custom DialogFragment and inside onCreateDialog i am creating AlertDialog and showing it.
use these as reference links
http://developer.android.com/reference/android/app/DialogFragment.html
http://www.cs.dartmouth.edu/~campbell/cs65/lecture13/lecture13.html

Related

Dropdown list of buttons

First I want to mention that I am a beginner in android.
Basically I am trying to implement the Microsoft's calculator in android.For now I am implementing only the UI.
Is it possible to make a dropdown list of buttons?
Like in this picture when you select Bitwise a list of buttons appears.Also is it possible Bitwise also to be a button and if not to act like one?
Yes, it is possible.
you must use a custom spinner.
By custom spinner, you can add any layout you like to your spinner; so you can create a layout that has a button.
You can search for Android custom spinner and learn about that.
I will give you an educational link about that.
How to add Custom Spinner in android?

Does anything like Combo-box in android

I need something like comboBox in android that have DisplayMember and ValueMember but for RadioButtons. I have a form that user should select one item, and I want to save the selected item in database. (the code of selected Item).
What should I do?
Take a look at Spinner,
Here's example about it http://developer.android.com/guide/topics/ui/controls/spinner.html
If u want something like radiobutton but can choose only one, use RadioGrop.
Or you can create your own dialog with radio button.
You can use setSingleChoiceItems property of alert dialog, which have radio buttons as you needed in question.
Check this example, it may help you.
Here is another link

Build a number selector dialog with AlertDialog (similar to DatePickerDialog)

With the DatePickerDialog we can have a fancy interface to set the date as this
(source: androidpeople.com)
I like it but it can only be used to set date so how could I build a "DatePickerDialog-like" AlertDialog?
I mean users could click on the "plus" and "minus" button as well as put in the number with keyboard.
Instead of only being able to select a single date, I'd be able to select three different numbers using the three up/down/scroll controls.
Alright, here you go, check this out. Then, check out Android Custom Dialogs, which would allow you to make your own custom dialog.
Check out this project for more information
Make an EditText field that they can edit with a button to the right which says Pick a Date and pops up a dialog. If the user selects the popup dialog, fill in the EditText with the result.
You can make a custom view with a "+" button, an edittext and a "-" button. Make a custom dialog with that view. Read about Android Custom Dialog. I hope I helped.

Make custom listview dialog look like standard dialog listview

I have a dialog with a listview, the first dialog is for selecting an item and the second one is when you edit the dialog. The first one uses a standard dialog box with no custom layout but for the second one I had to use a custom layout to get the picture in place (if anyone knows how I can populate a standard multiple choice dialog with an typed arrayadapter and item template let me know :)). The first dialog looks like standard dialog should look like but how can I get the second one to look the same with white background, lines between the items etc and be sure it always looks like the standard one even when that one is changed.
Standard
(source: filedump.net)
Custom
(source: filedump.net)
/Viktor
For the same, you need to use setMultiChoiceItems while creating dialog. I hope this example helps you: Android Multi selection dialogs
And also check this example: Android: Spinner-Like UI for Selecting Multiple Options

Custom Spinner Pop Up

I would like to modify the spinner pop up dialog . I would like to implement my own custom spinner pop up.
Is it possible or not ? Can anyone provide me solution to implement custom spinner pop up ?
This is an effort of uniformity for my various pop ups in my application.
see this here is the simple example which gives you the idea how to build custom spinner...
http://android-er.blogspot.com/2010/12/custom-spinner-with-icon.html

Categories

Resources