How to set AutoCompleteTextView drop down background to transparent in Android? - android

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.

Related

What is the Material design grey color of icons in Android?

I'm looking for the default Material design grey color of icons in Android. I use two icons but for some reason one is black and one is grey (although they original should be both black) and they have the exact same code:
I want to set the default grey color. Where can I find it? Even the hex value should solve this problem.
Using an eyedropper tool I found the hex code for the grey envelope, it's #737373.
If you're doing design work installing a tool like Color helps when it comes to finding an element's hex color. It includes an eyedropper tool that lets you click an element and get it's hex color.
For changing icon color try:
<ImageButton
android:layout_width="your value"
android:layout_height="your value"
...
android:tint="YourColor"
/>

android button green

i would like to have tha default button but not in gray.
I need to change the color green/blue/red.
I would like to do this thanks to xml but also from the code.
I need to have a green button which change the color of all the other button.
It's why i need to change from xml and from the code.
Define you colors in the color resource so it is easier to apply your desired colors via code or xml.

How to remove selected color on drag over listview

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

Color change of a button in code not reflecting

I'm trying to change a color of a button in code as below
btn_no5.setTextColor(0x8E35EF);
the above change is not reflecting(purple color), the text is disappearing after execution of above piece of code. But if i use the color in xml its reflecting. So how to change this through java ?
The color you are using is fully transparent. Use 0xFF8E35EF instead. The first byte is the alpha (transparency) channel.
use like this,
btn_no5.setTextColor(Color.parseColor("#8E35EF"));

Changing background color for items of Spinner

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.

Categories

Resources