Gaurav
Gaurav

Reputation: 667

Possbile to long press button and change its text in Android

I am able to long press a button and change its text using clipboard on 5.0 and above. On long pressing cursor appears and clipboard can be opened.

Any solution other that disabling the button ? I have tried setting onLongClickListener as null.Here is my button :

<Button
            android:id="@+id/btn1"
            style="@style/ButtonRegular"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_margin="@dimen/md_8dp_margin"
            android:gravity="center"
            android:minWidth="@dimen/width_280dp"
            android:padding="12dp"
            android:text="abc"
            android:textColor="@color/white" />

In my app when you longpress clipboard can be opened to chnage button text

Upvotes: 2

Views: 678

Answers (1)

Gaurav
Gaurav

Reputation: 667

It was my mistake. I was adding below line in button style which caused issue

<item name="android:inputType">textCapWords</item>

Upvotes: 1

Related Questions