I would like to use a spinner but only show the arrow on the right side like Android does in it's settings menu. (like for example by Screen timeout)
I can set the width to +/- 65px but then I've only got rounded corners on the rightside and not the left.
Thnx for your help!
Patrick
Are you sure they use a spinner?
You could achieve the same thing by simply placing a round button to the right-hand side and when pressed it triggers a popup ListView. The drawable for that button is...
"#drawable/ic_btn_round_more_normal"
If you are just trying to get it the dropdown to be all the way to the right rather than narrower, you can simply set the tag on the spinner in the xml to use android:layout_width="fill_parent". If you want to just have the button without the border, the Android Preferences have their own layout objects. I have just asked at elsewhere how to get those elements in a non-preferances view: Howto make a layout similar to the ones in settings.
What I did is the following:
Set the layout_width of the Spinner to 48dp and in code set an adapter which serves views with a size of 0dp x 0dp. The dropdown view is a normal (visible) view.
Related
When the button clicked, I want the height of Bottom Sheet change as seen in the image below. I tried multiple solutions none worked well.
Try doing something like:
Set the maximum height in XML and expand on button click
Call bottomsheet.setY(float)
I have a custom drop-down navigation ActionBar spinner and it works pretty well.
Only problem is, the width of the dropdown menu is always the same as that of the spinner.
Since the text in the spinner changes according to content, it sometimes gets ridiculously thin, which as demonstrated below, can be a problem...
I know that it's possible to set a dropdown width for spinners, but this isn't a regular spinner, it's not actually in the xml because it's a sub-view of the ActionBar.
Is there a way to interact with that view directly to set a width to the dropdown?
Is there another way to make the dropdown conform to the actual text in it?
Thanks in advance.
Oddly enough, this was solved the moment I changed the dropdown resource conatiner from a RelativeLayout to a LinearLayout. Specifically, it's the fact that the text was aligned to the left of the imagebutton that broke the design.
The moment I disabled that alignment or changed the entire thing to a linear layout, it started adjusting to the content's width.
I try to do a custom keyboard, so I have a small buttons and the text doesn't fit in my buttons, but it have a few pixels for it:
Can I increase text container width inside my buttons?
You can try:
set button Paddings to zero:
button.setPadding(0,0,0,0);
(I dont really know how custom keyboards work but you may try using TextViews instead of Buttons, and you can set your Image or Background to your TextView aswell. Can use pressed states with selectors and etc...)
Or you can make your own class, and #Override their onDraw method to draw your own text(or charachter) for your view.
As far as i know there are no specific methods to increase text container.
You may consider using ImageButton instead of an ordinary Button as keyboard buttons. As you will have the freedom to edit the image the way you want to.
How would I make a ListView like this ?
I know how to make a customized ListView, but I do not know how to adjust the size of the background with the entered text so the text fits in the background.
Can anyone help me with tutorials or put me in the right direction?
Here is a nice example with source code,
Bubble ListView like Iphone
You can use a relative layout to align your text to the right or the left, and a wrap_content value for the width or your textview
I want to know how to set the size of spinner.When i added large values to spinner list,the spinner expands and as result it pushes the labelField to the further left.
I want to know the how to set the spinner size to be a constant one
Presumably, you presently have the Spinner set with android:layout_width="wrap_content". That will expand as the values expand. If that is not what you want, do something else. RelativeLayout is particularly useful here, as you can anchor both the left and right sides of the Spinners to things they should not expand past (e.g., left to another widget, right to the right edge of the screen).
Just in case anyone come to this page again... One may refer to here:
How to change spinner text size and text color?