@Override protected void initStyles(AttributeSet attrs) { super.initStyles(attrs); TypedArray ta = this.getContext().obtainStyledAttributes(attrs, R.styleable.doc); if (ta.hasValue(R.styleable.doc_dateFormat)) { formatDate = new SimpleDateFormat(ta.getString(R.styleable.doc_dateFormat)); } else { formatDate = new SimpleDateFormat("yyyy-MM-dd"); } if (ta.getBoolean(R.styleable.doc_showDefaultValue, true)) { c = Calendar.getInstance(); setValue(c); defaultValue = (String) getValue(); } ta.recycle(); }
@Override public void setEditable(boolean editable) { super.setEditable(editable); valueView.setEnabled(editable); }