Is it possible to remove/change color of the delimiter in AutoCompleteTextView's popup ? In ListView I get use of the "delimiter" parameter, but I haven't found any similar in AutoCompleteTextView.
Thanks.
Use an Adapter for your AutoCompleteTextView.
Then, you can do something like this :
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
The layout can be configured by you.
A quick fix solution, for removing the divider, might be writing a custom XML to override the style for each cell (Through the SetDropDownViewResource). After that you can change the android:popupBackground property on the autocompletetextview to match it to the color of your item's background.
Related
I want to implement AutoCompleteTextView something like what Gmail app in Android does.
I am not sure how to set "To" fixed text on the left side of AutoCompleteTextView.
How is this implemented? Do I have to put TextView inside AutoCompleteTextView to show "To" label. If I do that my cursor starts from the beginning of AutoCompleteTextView and not after TextView.
How should I achieve this view
You can put a TextView to the left of the AutoCompleteTextView. Use a horizontal LinearLayout for that. You can set the border (the underline with the little ticks) on the linear layout if you want one.
My style of implementation of it is to use android:drawableLeft. Create a drawable(could be image) first which in your case "To". Then apply it in the xml declaration of your AutoCompleteTextView like this.
<AutoCompleteTextView
android:id="#+id/auto_complete_textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/to_drawable_label"/>
I hope this helps. :)
you just need to create an adapter and set it to AutocomleteTextView.
Often i like default android style defined for some widget.
Often i like to just slightly modify this default style, not create my own style from a scratch.
Now, i use android.R.layout.simple_spinner_dropdown_item as dropDownViewResource on my spinner adapter - like this:
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
I can open this layout xml file and copy its content to modify it. But the most important part of that xml file is attribute style, it looks like this: style="?android:attr/spinnerDropDownItemStyle"
Now, my question is: how do i find/view/copy this style spinnerDropDownItemStyle, so i can for example just change background color.
Thanx for your help
here you can find style spinnerDropDownItemStyle:
https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/themes.xml
But, if you looking for change background of Spinner, you'll need to search for 9 patch images:
https://developer.android.com/studio/write/draw9patch.html
And here a good example:
http://www.gersic.com/blog.php?id=57
Ty
My suggestion to you is . you can make a seprate custom layout and put it on your spinner setDropDownResource()
adapter.setDropDownViewResource(android.R.layout.CUSTOM_LAYOUT);
Now you can easily make a style for your layout
I am displaying a ListView. When I drag over it, the entire ListView is selected with a black background. How can I remove that black background?
just use in ur xml file inside ListView,
android:cacheColorHint="#android:color/transparent"
It's probably because you have a custom background for your ListView. When you scroll those, the entire list gets highlighted in a black color due to its cache color.
Add this piece of code to your ListViewand try again:
android:cacheColorHint="#00000000"
view.setBackgroundColor(android.R.color.transparent);
should be view.setBackgroundResource(android.R.color.transparent)
cause setBackgroundColor take a hex color value as parameter.
or
android:cacheColorHint = "#00000000"
use this tag for the your listView. or you can also use
listview.setCacheColorHint()
to set it programatically.
From Why is my list black? An Android optimization on the Android developers' blog:
To fix this issue, all you have to do is either disable the cache color hint optimization, if you use a non-solid color background, or set the hint to the appropriate solid color value. This can be dome from code or preferably from XML, by using the android:cacheColorHint attribute. To disable the optimization, simply use the transparent color #00000000. The following screenshot shows a list with android:cacheColorHint="#00000000" set in the XML layout file:
use this,
yourList.setCacheColorHint(Color.WHITE);
As the subject suggests , how to set the transparent background to AutoCompleteTextView dropdown. I can apply any style to the view(TextView) that dropdown box shows but to make the drop down itself transparent I am not able to do !
Any hints or solution ?
Thanks
set android:popupBackground to #0FFF in xml
Thanks , got what I was looking for ,
I can change background image of dropdown using
setDropDownBackgroundResource();
and set semi-transparent png.
You have two options:
XML Attribute:
android:popupBackground
The background to use for the popup window.
May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
Java Attribute
setDropDownBackgroundResource
Sets the background of the auto-complete drop-down list.
I am working on Android application.I am using Spinner control and added items to it.
Is there a way to change the background color of items in spinner.
can any one help me in sorting out this issue.
Thanks in Advance,
If you completely want to customize your background spinner, you should use 9patch background.
Here is a tutorial that explain how to do that :
http://www.gersic.com/blog.php?id=57
Otherwise, the solution given by user432209 is the simplest.
However, if you want to do that in xml layout :
<Spinner android:id="#+id/spinner"
...
android:background="#YOUR_HEXA_COLOR"/>
You can use
yourView.setBackgroundColor(int color)
You can also use android:popupBackground="YOUR COLOR" which will define the items background not the whole spinner's background.