Code example for EditText

Methods: setEnabledsetImeOptions, setLayoutParams

0
	 
	// PRIVATE ==================================================================================== 
	 
	private void initialize(AttributeSet attrs) {
		// setup edit text 
		mEditText = new EditText(getContext(), attrs);
		mEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);
		mEditText.setEnabled(true);
		mEditText.setLayoutParams(new ViewGroup.LayoutParams(
				ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
		 
		// setup layout for edit text 
		int dip = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10,
				getContext().getResources().getDisplayMetrics()) + 0.5f); 
		 
		mEditTextlayout = new LinearLayout(getContext());
		mEditTextlayout.setLayoutParams(new ViewGroup.LayoutParams(
				ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
		mEditTextlayout.setPadding(dip, dip, dip, dip);
		mEditTextlayout.addView(mEditText);
	}