Android EditText prohibits the copy and paste of the complete code. androidedittext

Source: Internet
Author: User

Android EditText prohibits the copy and paste of the complete code. androidedittext

<! -- Define basic layout LinearLayout --> <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: tools = "http://schemas.android.com/tools" android: layout_width = "match_parent" android: layout_height = "match_parent" android: paddingBottom = "@ dimen/activity_vertical_margin" android: paddingLeft = "@ dimen/plugin" android: paddingRight = "@ dimen/activity_horizontal_margin" android: paddin GTop = "@ dimen/activity_vertical_margin" android: orientation = "vertical"> <! -- Define the TextView control --> <EditText android: id = "@ + id/Et" android: layout_width = "match_parent" android: layout_height = "wrap_content" android: text = "prohibit copy and paste" android: longClickable = "false"/> </LinearLayout>
Package com. example. yanlei. yl2; import android. content. clipboardManager; import android. OS. bundle; import android. support. v7.app. appCompatActivity; import android. view. actionMode; import android. view. menu; import android. view. menuItem; import android. widget. editText; public class MainActivity extends AppCompatActivity {EditText Et; @ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); // call the onCreate method of the parent class // set the layout file of the current page to activity_main setContentView (R. layout. activity_main); Et = (EditText) findViewById (R. id. et); Et. setCustomSelectionActionModeCallback (new ActionMode. callback () {@ Override public boolean onPrepareActionMode (ActionMode mode, Menu menu) {return false;} @ Override public void onDestroyActionMode (ActionMode mode) {}@ Override public boolean onCreateActionMode (ActionMode mode, Menu menu) {return false ;}@ Override public boolean onActionItemClicked (ActionMode mode, MenuItem item) {return false ;}});}}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.