我实现了一个 ImageButton。一切正常,除非我按下它,它在继续(进行另一项 Activity )之前不会“闪烁”。 Android 是否具有 ImageButton 的固有“flash”,或者我必须在 onClickEvent 中明确地编写/制作动画?或使用选择器?
预先感谢您的所有帮助。
最佳答案
如果你让你的 ImageButton 保持它的背景并且不将它设置为 null,它会像一个普通按钮一样,在点击时会闪烁,就像其他按钮一样。隐藏背景的方法是:
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="1dp"
android:paddingLeft="1dp"
android:paddingRight="1dp"
android:paddingTop="1dp"
android:src="@drawable/squareicon" />
内边距不会让背景可见并使按钮像其他按钮一样工作。
关于Android imagebutton 在点击时不闪烁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5816700/