开发者

Button with background, no cursor

开发者 https://www.devze.com 2023-01-13 06:47 出处:网络
I\'m trying to customize my buttons in my view a bit and give them my own look. Whenever I set a picture as a background so that the button looks different though, I seem to lose my cursor. I can use

I'm trying to customize my buttons in my view a bit and give them my own look. Whenever I set a picture as a background so that the button looks different though, I seem to lose my cursor. I can use my trackball to go through the items still but when I come to one of my custom buttons the cursor does not show. I have the same problem with some TextViews that I made clickable. Any ideas?

(this is a button which i am trying to g开发者_如何学Pythonive a custom look by giving it a background. when i give it a background though, the cursor does not show when it is over it.)


Your background drawable needs to be a state list drawable (or selector) so that you can provide a background image for the focused state. Take a look at the default background drawable used by buttons on Android:
https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/drawable/btn_default.xml

0

精彩评论

暂无评论...
验证码 换一张
取 消