0
帮助!我有一组edittext字段在(LinearLayout),我启用和禁用编程。 当我启用和禁用字段screenshot时,edittexts宽度没有问题。问题就来了edittexts启用后,要么android所有的edittext宽度在方向变化和焦点上的变化
这里是我的editexts的一个代码。其余都是一样的,只有id是不同的。
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/purchase_price"
android:imeOptions="flagNoExtractUi|actionNext"
android:maxLines="1"
android:singleLine="true"
android:inputType="numberDecimal">
这里是启用字段的代码。
public void onCreate(Bundle savedInstanceState) {
enabledEdittext = mPurchasePrice.getBackground();
disabledEditext = ContextCompat.getDrawable(this, R.drawable.disabled_edittext);
.
.
.
mPurchasePrice.setBackground(enabledEdittext);
}
我改变了背景,因为客户的要求是当禁用字段时删除edittext下的行。 – vyxf