A long-press material creation button allows you to insert buttons into the shortcut

Background

I have a standard Material Design button as shown below

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.AppCompatButton
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="@dimen/medium_margin"
    android:layout_marginRight="@dimen/medium_margin"
    android:textStyle="bold"
    tools:text="I am a Button"
    style="@style/PrimaryColoredButton" />

The style applied to it is as follows

<style name="PrimaryColoredButton" parent="Widget.AppCompat.Button.Colored">
    <item name="android:textColor">@color/white</item>
    <item name="android:capitalize">sentences</item>
    <item name="android:background">@drawable/primary_button_background</item>
</style>

Problem

When the button is pressed for a long time, the system paste button appears and allows the user to paste the contents into the Button shortcut.

Material button showing insert option

Then after insertion:

enter image description here

I see no way to stop this from an XML perspective, but it seems like this should not be possible at all.

It is interesting that this happens only when a long press not on the text, but on the background itself.

+4
source share
1 answer

AppCompatButton s, . , Button TextView, , , capitalize . , none, , TextView internal Editor .

, , , , Button , , . , , - capitalize, digits, autoText , , inputType, none. textIsSelectable , Button un-editable EditText. , CAB, , Button .

, Button, , Button, , . , , , Editor. (, ), , .

, capitalize , Button. , Button s, longClickable false.

, () editable false , .

+1

All Articles