Possbile to long press button and change its text in Android

别来无恙 提交于 2020-01-06 02:54:09

问题


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


回答1:


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

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


来源:https://stackoverflow.com/questions/37206806/possbile-to-long-press-button-and-change-its-text-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!