Android :: Coloring Default Buttons / Color Filter Only On Unfocused State
Feb 2, 2010
I want to buttons of different colors, but I want to do so while using the default button background resource in order to preserve the onfocus and onclick states. This is because I want to use the default highlight color of the OS for my app, which is NOT always orange (HTC Sense makes it green).I found that adding a color filter to the button's background drawable works great (in this case, blue).
To give the user of my app an indication which field currently has the focus I am trying to change the background color of some of my fields depending on the current state, however, I am having troubles understanding Androids Color State List Resources:
There is this example at the bottom of http://developer.android.com/guide/topics/resources/color-list-resource.html. If I try exactly the same, i.e. if I want to adapt the textColor , things do work. However, if I try an only slightly different thing, namely to adapt the background color, things do not work and I don't understand why? Why is this so inconsistent?
To make it simpler to understand what I am trying to do, I append my misc. .xml files:
The AndroidManifest.xml file:
If I run this as shown here, it works, i.e. I get a button whose text color changes depending on whether the button is focuses, pressed, etc.
If I uncomment the lower button, where I just flipped the attribute values for textColor and background I get an exception, stating
... <item> tag requires a 'drawable' attribute or child tag defining a drawable
What the heck am I missing here? Why is that color state list acceptable as a text color but not as a background color? How does one specify a view's background color depending on the view's state?
I'm trying to make an image darker, but the image has some pixels transparent. I want to keep those pixels intact. I tried DARKEN and couple other filters, but they seem to alter transparent pixels as well.
Do you know if there is a way to keep transparent pixels intact while applying a color filter?
I had a ROM once that came with a widget built in that allowed me to apply different filters to my screen. For example, I could make everything red or blue. I don't remember what the widget was called but I remember it really saved my eyes in the middle of the night if I had the red filter enabled.
What this app/widget is called and where I might be able to get it?
Trying to grok intents and actions in android and looking through the documentation. But one thing I keep seeing is an intent filter with multiple actions defined.
Like this, from the above link:
But, if you call that activity, how does it choose which action is chosen?
For that matter, that linked to example has multiple activities that all contain the same actions, "android.intent.action.VIEW" for example. When calling this with something like content://com.google.provider.NotePad/notes how does it even know which activity to use?
I would like to know the way to make a user interface for Android for people that have low vision. The idea is to make a UI with the following features: 1- Uses very very big buttons. 2 -Uses very big font size. 3- Te colors to use are basically black and white (for more contrast). 4- The icons in this UI are not relevant. 5- We must sacrifice the number of chars that we can show in the screen to get bigger labels and buttons. 6- A simple zoom system for the images should be a great idea. 7- We can use the camera of the phone to get a magnifying glass. I'm member of a blind people association in Spain and we think that this should be a great idea for begining a new low-vision-user- interface that is not aviable in the market for the new mobile phones. This will help many people that uses movile phones but have many difficulties to work with them.
I'm currently having trouble with a SlidingDrawer. I want it to be closed when the application starts so it doesn't get in the way. However, it is determined that it will be open, despite putting slide.close() in the onCreate() of my activity. It seems to be closed if i use slide.animateClose() instead, but this slows my application down loads.
I'm trying to develop a coloring app... while developing it ....i was stuck with a problem..Im using layout to display "images". The problem is that the images get overlapped...
for example i have arranged the images as ...the second image inside the first image.... if i color the second image, the first image also gets colored...similarly if i color the first image , the second one also gets colored....the images are overlapped....
how to color each image separately ? and how to prevent overlapping of two images?
I am trying to remove an ImageButton's background in only the default state. I'd like the pressed and selected states to behave as usual so that they look correct on different devices, which use different colors for the pressed and selected states.
Is there any way to set an ImageButton's background default state's drawable without affecting the pressed and selected states?
I've tried to do this with a selector, but it does not appear to allow you to use the default drawables for some states - you have to set all the states yourself. Since there's no API to retrieve the device's default pressed/selected drawables, I don't know what to set the pressed/selected states to.
I also tried getting the StateListDrawable object for the button that the system creates when you are not using a selector and then modify it change the default state. That didn't work either.
I seems that on Android, if you want to change the drawable for one state of a button, then you must set all the states, and thus cannot preserve the default drawables for the other states. Is this correct?
How could I be able to change text color in buttons? From the image, I tried changing the boxed text from '<item name="textColor">@color/primary_text_holo_light</item>', and creating my own drawable xml file to link it with that. Color change seems successful, but it also affects other holo white buttons as well (see image). I don't want it to happen, for it renders those buttons unreadable.
I want to theme my gingerbread to jb.i've faced the problem with button.when i used blackish button(png).the text (ok,cancel) were almost got hidden.cause the text color are black.how to change it to white like ics/jb.For android 2.3.5
now that we have a beautiful custom battery icon (thanks again Kelmar!) I would like to try to do some more customizations. My Hero is SO close to what I like now, only need one more change to make it perfect. I'd like to figure out how to change all of the green highlighting to blue on the Hero. (Like on the ZenRom) Things like: when you press a button (say the call button, as an example) or icon or widget, and things like the progress bar in the browser... also things like the unread mail indicator, and the rating stars in the market...etc. Kelmar and I have been reading on XDA, and have tried many things, and we are getting nowhere. Everything seems to lead to a very long tedious process. It would seem to us that some of this might be able to be easily changed in one file, to make the change throughout the rom, but we could be wrong. We wonder if anyone here could help out with how to do this.
How do you change the notification sound for calendar? The one that goes off on calendar is different than the notification sound in settings. Annoying!Also, any idea how to change the color of the default calendar (exchange not google?)Seems like Samsung makes a lot of these kind of settings much harder to find/change than HTC.
I have a compound UI component built up from a ViewGroup containing a number of TextView, ImageView etc. components. Many of these have StateListDrawables as their images/backgrounds. Is there any way of making them select from this drawable based on the state of the parent ViewGroup rather than the component itself? Ideally I want to be able to change the visual state of all children of the ViewGroup (text colour, image etc) based on the state of the ViewGroup, preferably without having to hook up complex logical code. This seems like a fairly common sort of requirement, so I was hoping it would be straightforward in Android - am I going to be disappointed?
Is there a way to change the color scheme in the phone app, which also looks like the system default color scheme of white text on black background?Walking outside in bright sunlight looking at white text on black background is nearly impossible to see. Black text on white would be much better.
I'm a little confused by what I'm seeing with regards to phone state transitions via the PhoneStateListener. When I receive a call, this is what happens: (call comes in) RINGING -> IDLE (I pick up) OFFHOOK (I hang up) IDLE It's that first transition from RINGING to IDLE without any interaction from me (not ending the call, not answering the call) that confuses me. Do I really have to implement an idle counter to know that an incoming call has really ended? Seems like the reported phone state represents some sort of phone state that isn't the obvious one.Is this a bug or am I just not in tune with the paradigm here?