下划线编辑文本
答
您可以使用自定义样式为您的EditText在style.xml
这样的 -
<!-- Edit text -->
<style name="editTextStyle" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textSize">@dimen/auth_text_paragraph_little</item>
<item name="android:layout_gravity">left</item>
<item name="android:focusable">true</item>
<item name="colorControlNormal">@color/editUnderLine</item>
<item name="colorControlActivated">@color/colorAccent</item>
<item name="colorControlHighlight">@color/colorAccent</item>
<item name="android:textColorHint">@color/hint</item>
</style>
@color/editUnderLine
是你想从color.xml
文件中使用颜色的名称像为string.xml
文件和文件dimen.xml
,并在你的XML使用自定义样式布局 -
<EditText
android:id="@+id/edt_phone_number"
style="@style/editTextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/auth_margin_half"
android:padding="@dimen/auth_margin_half_plus"
android:fontFamily="@string/auth_font_family_regular"
android:hint="@string/auth_mobile_number"
android:inputType="phone"/>
你有没有试过这个:http://*.com/a/37101446/2632867 – Alvi