在悬停按钮的颜色变化 [英] Button color change on hover
问题描述
我只是一个与Android初学者。我希望按钮来改变鼠标悬停颜色。
我不知道该怎么做,在机器人。能不能做到?
查看一个按钮:
<按钮
机器人:ID =@ + ID / B8
机器人:文本=点击我
风格=机器人:ATTR / buttonStyleSmall
机器人:TEXTSIZE =20dp/>
您需要使用什么叫做选择
。
您可以了解他们,并得到来自这个网站的教程。一>
请注意,是不是真的有在Android的一个概念是盘旋,因为你不能悬停你的手指在显示器。但是,您可以创建选择,比如说,当按钮具有焦点。通常,一个按钮就可以有三种状态:正常,重点突出,pressed
I'm just a beginner with Android. I want the button to change its color on mouseover.
I don't know how to do that in android. Can it be done?
View for a button:
<Button
android:id="@+id/b8"
android:text="click me"
style="?android:attr/buttonStyleSmall"
android:textSize="20dp" />
You need to use what's called a selector
.
You can read about them and get a tutorial from this site.
Keep in mind that there really isn't a concept in Android as "hover" since you can't hover your finger over the display. But you can create selectors for, say, when a button has focus. Normally a button can have three states: Normal, Focused and Pressed.
这篇关于在悬停按钮的颜色变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!