Android examples for User Interface:View Layer
set View Layer Type None
import android.app.Activity; import android.content.Context; import android.text.Editable; import android.text.InputFilter; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.MarginLayoutParams; import android.view.inputmethod.InputMethodManager; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Main{ private static final String TAG = ""; private static final int LAYER_TYPE_NONE = 0; public static void setLayerTypeNone(View view) { setLayerType(view, LAYER_TYPE_NONE); }/*from w ww . j a v a2s. c o m*/ public static void setLayerType(View view, int type) { try { Class[] paramTypes = new Class[1]; paramTypes[0] = Integer.TYPE; Method setLayerTypeMethod = view.getClass().getMethod( "setLayerType", paramTypes); setLayerTypeMethod.invoke(view, type); Log.d(TAG, "setLayerType successfully called"); } catch (NoSuchMethodException e) { // method does not exist in this api level } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } }