I have an xml that declare the button background:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@color/selector_pressed" />
<item android:state_focused="true" android:drawable="@color/selector_focused" />
<item android:drawable="@android:color/transparent" />
</selector>
On my phone Samsung Nexus S (android 4.0.3) , this xml work perfectly, when i press the view the background color change. But I got a problem on tablets (Samsung Galaxy tab, Android 3.2), the button is clicked but i don't see any changes for the backgroung. The background color never change for tablets.
Any one have an idea why this happening only for tablets? and how can i fix this?
I used :
it's working with very fine
try getting rid of the
could just be the way that version of OS intercepts pressed and focused. just a guess tho, didn't really test it.
Try changing your .xml to:
of coures you can set your color to anything you'd like. That is if you are using static colors. you could add gradients and rounded edges and a border to this too.
I would suggest you to adjust your layout on each layout folder
and call your xml on each layout. It could be that when it was clicked in tablet, it was not displayed properly, I once experienced that issue too because the dimension or the resolution did not match, so the color is not displaying properly as well.
I've had the same problem but I've managed to solve this: the actual problem lies in a defect in android 3.2 regarding hardware acceleration so if you put in your AndroidManifest that your application is hardwareAccelerated="true" your problem will be solved.