相关疑难解决方法(0)

具有选定状态的Android ImageButton?

如果我使用带有选择器的ImageButton作为其背景,是否有一种状态我可以改变它会改变它的外观?现在我可以让它在按下时更改图像,但似乎没有"突出显示"或"选中"或类似状态,这让我可以随意切换其外观.

这是我的XML; 它只会在按下时改变外观.

 <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/map_toolbar_details_selected" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/map_toolbar_details_selected" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/map_toolbar_details_selected" />
<item android:drawable="@drawable/map_toolbar_details" />
Run Code Online (Sandbox Code Playgroud)

android button imagebutton

81
推荐指数
3
解决办法
13万
查看次数

单击后如何按下按钮?

可能重复:
Android.在按钮创建的操作完成之前,如何将按钮显示为PRESSED?

我有一个按钮,我希望当我按下它时,它会保持按下状态(Froyo上的绿色).

有帮助吗?

mycodes_Button = (Button) findViewById(R.id.mycodes);
...
if (saved_Button.isPressed())
{
    saved_Button.setFocusable(true);
}
Run Code Online (Sandbox Code Playgroud)

像这样的东西?

android pressed button

34
推荐指数
3
解决办法
6万
查看次数

标签 统计

android ×2

button ×2

imagebutton ×1

pressed ×1