下划线下面的“密码”布局
问题描述:
我想实现这种类型的布局,而无需使用库:下划线下面的“密码”布局
我想用一个EditText
场,但我的问题是执行下面的下划线EditText
字段下的当前数字,并使其动态。我可以如何实现这一点的任何提示?
答
尝试这种使用horizontal LinearLayout
<EditText
android:id="@+id/edDigit1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:hint="1"
android:imeOptions="actionNext"
android:inputType="number"
android:maxLength="1" />
<EditText
android:id="@+id/edDigit2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:hint="2"
android:imeOptions="actionNext"
android:inputType="number"
android:maxLength="1" />
<EditText
android:id="@+id/edDigit3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:hint="3"
android:imeOptions="actionNext"
android:inputType="number"
android:maxLength="1" />
<EditText
android:id="@+id/edDigit4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:hint="4"
android:imeOptions="actionNext"
android:inputType="number"
android:maxLength="1" />
</LinearLayout>
谢谢您的回答!任何可能的方法,使其在一个单独的EditText中,并在每个数字输入下面添加动态下划线(例如,在成功输入后更改其颜色和厚度)? – beerprophet
单个编辑文本@beerprophet不可能 –