public class AdaptiveEdit extends EditText {
private static String TAG = "AdaptiveEdit.java";
private static boolean isDebug = false;
/** 字大小与控件高的比例 */
private float m_fTextSizeRatioViewHeight = 2.0f / 3;
public AdaptiveEdit(Context context) {
super(context);
init(null);
}
public AdaptiveEdit(Context context, AttributeSet attrs) {
super(context, attrs);
init(attrs);
}
public AdaptiveEdit(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(attrs);
}
private void init(AttributeSet attrs) {
// 读取用户配置的参数
if (attrs != null) {
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.MyAdaptive);
// 获取字大小与控件高的比例
m_fTextSizeRatioV