Here is a button with background that gets no focus when touch it. Here is the xml:
<Button
android:id="@+id/continueID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/buttonbg"
android:focusableInTouchMode="true"
android:focusable="true"
android:onClick="invokeLogin"
android:text="Login"
android:textColor="#F7F9FA" />
'buttonbg' background must handle the focused state so you can see changes when you touch it.
For example:-
// buttonbg.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@drawable/your_imagename_while_focused"/>
<item android:state_pressed="true" android:drawable="@drawable/your_imagename_while_pressed" />
<item android:drawable="@drawable/image_name_while_notpressed" /> //means normal
</selector>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.