- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我希望按钮背景在单击按钮后保持某种颜色,并在按下其他按钮时再次更改颜色。我认为这是“state_focused”状态。
但我的按钮似乎只有两种状态是按下或未按下。
我是否正确理解 state_focused 状态,还是我的 StateListDrawable(见下文)错误?
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="false"><shape>
<solid android:color="#00ff00" />
</shape></item>
<item android:state_pressed="true"><shape>
<solid android:color="#ff0000" />
</shape></item>
<item><shape>
<solid android:color="#0000ff" />
</shape></item>
</selector>
最佳答案
state_focused
是当按钮使用 dpad 或轨迹球聚焦时。使用触摸时, View 通常不会显示焦点状态。
关于android - Button 的 "state_focused"状态是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8852420/
我的xml文件 btn_selector.xml Activity .java ImageButton btn1 = (ImageButton) findViewById(R
例如,我有几个按钮和一个 ImageView。我用键盘控制安卓,对于聚焦或按下的按钮,我使用不同的状态图像。 现在我需要更改聚焦按钮上的 ImageVie
我希望按钮背景在单击按钮后保持某种颜色,并在按下其他按钮时再次更改颜色。我认为这是“state_focused”状态。 但我的按钮似乎只有两种状态是按下或未按下。 我是否正确理解 state_focu
我正在尝试根据其状态更改 TextView 样式。我的 styles.xml 包含: left @color/text_usual_color bold
我花了很多时间试图解决这个问题,但没有成功。 我基本上是在尝试在单击列表项时更改它们的颜色。 我制作了一个选择器xml文件并将其存储在res/color/red_background.xml
我是一名优秀的程序员,十分优秀!