Android examples for User Interface:EditText
lock EditText
//package com.java2s; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.widget.EditText; public class Main { public static void lockEditText(final boolean locked, final EditText editText) { editText.clearFocus();//from w w w . j a v a 2 s . com if (locked) { editText.setFocusable(false); editText.setCursorVisible(false); } else { editText.setCursorVisible(true); editText.setFocusableInTouchMode(true); } Drawable background = editText.getBackground(); if (background != null) { if (locked) { background.setAlpha(Color.TRANSPARENT); } else { background.setAlpha(255); } } } }