Custom theme for spinner dialog - android

I would like to customize the appearance of the dialog that appears when I click on the spinner in spinnermode=dialog.
I want to use a dialog fragment but I find no documentation.
Is it possible?

No. The appearance is fixed to give it the feel of the operating system. You would have to create your own spinner to do this which isn't easy but also not too difficult if the lists in your spinner won't get so large that it takes up all the phone's memory. Just make a control that can scroll vertically.

Related

Android Spinners with different Display text from the list values

I'm playing around with Android spinners. I'm not 100% sure if I can get the behavior I want using a spinner, but it's the most obvious choice that comes to mind.
I need something of a dropdown view, the title of which says "x of y selected".
The options in the dropdown would look like:
-All
-None
-Special items only
On clicking one of the dropdown items, the title is reconfigured such that 'x' changes.
It would be ideal to use a spinner, but somehow, it seems that android puts in the first value of the spinner to always be the first values in the list of strings you pass it, and I clearly don't want the title item to be shown in the dropdown list for my case.
Another approach that I came across was to perhaps use a button with a popup with these items in the popup.
Would that be a better approach, or can I actually achieve the behavior using a spinner, or is there another view that would better serve my purpose?
I'm going to redirect to this post, after a lot of searching I found what I was looking for:
How to hide one item in an Android Spinner
The answer by Aebsubis, and make sure to set the text view height to 0. I'll update this answer with more code, once I'm done with tweaking it for my purposes.

how can I add a spinner in a category preference

I need to add a spinner in my PreferenceCategory with a text on its right is there a way to do that? plus when I create a checkboxpreference the text is on the left how can I make the text appear on the right?
thanks.
If you want to use these built in controls you have to use them the way they are designed. Its also good because it fits the android design that users expect.
If you need to do something different, just make your own preference screen. Its just a list view with click handlers, not too hard to make on your own. Then you get the styling you want.

Android Custom Dialogue Box

Hi I want to make a custom dialogue box for my android application and want to populate it with buttons, check boxes and such kind of items.
I have followed the tutorial from android developers website, but that is not what I want, actually I want to customise the background and size of the dialogue box.
Please if any body could give me a head start, Plus I want to know when I design a background for that box, what dimensions and pixel numbers I use so that it may run the same in Galaxy Note, Galaxy S and tablets and other mobile phones running android.
Here is the picture of customised dialogue box. Like that I want to work out something.
Yes this is a good question. You must use a custom dialog with a transparent bg theme like these:
Dialog dialog = new Dialog(mContext, android.R.style.Theme_Translucent_NoTitleBar);
dialog.setContentView(R.layout.custom_dialog);
dialog.show();
where custom_dialog will be your XML for the dialog layout, and as far as dimensions go you should really test your app on a number of different screen resolution devices to ensure it displays as you want.
On occasion I have wanted to create a fully customized dialog such as the one you've shown.
When I had to do it, I fought for a while trying to make it a Dialog. In the end I found it was far easier to just wrap my dialog in its own activity, set it to theme transparent in the manifest, and make the layout xml file such that there was transparent space around the edges. That was the easiest way for me to get rid of all of the default dialog formatting (i.e. the frame that it comes in if you do it with the setContentView() route)
So while it is not technically a dialog any more, to the user it serves the same purpose.

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

How to customize the styling of the radio buttons in an AlertDialog.Builder?

I'm wondering if there's a way to customize the look of the radio buttons in an AlertDialog.Builder? I have a selector XML file that works great for my custom radio button images, but I don't know how to assign it to an AlertDialog.Builder. Is it possible, or do I maybe need to create a completely custom Dialog? Any help/advice would be appreciated, thanks!
you can set a custom layout to your alert dialog which will contain your custom radio buttons (maybe a static number or a listview of items containing radio buttons depending on what you need) but it is surely possible.
Me personally if your view has even a bit more functionality than the default and you can see its future getting more and more customized and extended, i always make a custom dialog extending the Dialog class. its about the same amount of work but can go a long way in improving and adding features.
Hope this helps.

Categories

Resources