-1
<android.support.design.widget.TextInputLayout
                    android:id="@+id/input_layout_Division"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp">
                    <com.efftronics.android.eEmployee.Common.UI.CustomAutoCompleteTextView
                        android:id="@+id/actventryDivName"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:hint="@string/station"
                        android:maxLength="250"
                        app:hintTextAppearance="@style/AutocompleteTheme"
                        android:longClickable="false"
                        android:theme="@style/AutocompleteTheme"
                        android:singleLine="true"
                        android:imeOptions="actionNext"/>
</android.support.design.widget.TextInputLayout>

Options are displaying Eventhough I made the longclickable false to the textinputLayout, It will display the cut, copy, share options. Why?

I dont need these options. What can I do? Any help would be appreciated.

vishnu
  • 337
  • 4
  • 14

2 Answers2

0

If you are using API level 11 or above then you can stop copy,paste,cut and custom context menus from appearing by.

if (android.os.Build.VERSION.SDK_INT < 11) {
        editText.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {

            @Override
            public void onCreateContextMenu(ContextMenu menu, View v,
                    ContextMenuInfo menuInfo) {
                // TODO Auto-generated method stub
                menu.clear();
            }
        });
    } else {
edittext.setCustomSelectionActionModeCallback(new ActionMode.Callback() {

            public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
                return false;
            }

            public void onDestroyActionMode(ActionMode mode) {                  
            }

            public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                return false;
            }

            public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                return false;
            }
        });
}

Returning false from onCreateActionMode(ActionMode, Menu) will prevent the action mode from being started(Select All, Cut, Copy and Paste actions).

Qandil Tariq
  • 539
  • 1
  • 3
  • 15
0

try this

      FirstName.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            return true;
        }
    });