下划线下面的“密码”布局

问题描述:

我想实现这种类型的布局,而无需使用库:下划线下面的“密码”布局

enter image description here

我想用一个EditText场,但我的问题是执行下面的下划线EditText字段下的当前数字,并使其动态。我可以如何实现这一点的任何提示?

尝试这种使用horizontal LinearLayout

enter image description here

<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> 
+0

谢谢您的回答!任何可能的方法,使其在一个单独的EditText中,并在每个数字输入下面添加动态下划线(例如,在成功输入后更改其颜色和厚度)? – beerprophet

+0

单个编辑文本@beerprophet不可能 –