Marcel Hensons Marcel Hensons - 3 months ago 9
Java Question

How to disable the Android text highlighter for buttons?

I'm currently developing an app displaying the default android buttons:

Screenshot

screenshot

Why is that little blue mark (i don't know the correct name) showing in my app?

This is how I make it visible: I hold the button and then swipe from right to left over the text until the marker appears.

Usually I get that marker in EditText when selecting text - However this is a button and no EditText!



My XML for the button:

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Sign in"
android:id="@+id/loginButton"
android:layout_below="@+id/mainLin"
android:layout_centerHorizontal="true"
android:backgroundTint="#2196F3"
android:textColor="#333"
android:textAllCaps="false"
android:layout_gravity="right"
android:enabled="true"
android:layout_marginTop="5dp" />

Answer

try in your XML :

android:textIsSelectable="false"
android:longClickable="false"