TextInputEditText样式设置

TextInputEditText样式设置

样式调整

<style name="InputStyle">
   -- 底部线 默认颜色 -->
   <item name="colorControlNormal">@android:color/white
   
   "colorControlActivated">@android:color/white
   
   "android:textCursorDrawable">@drawable/line
style>

android:textCursorDrawable@null时光标颜色与textColor相同,但是目测宽度只有1dp左右,太细了,所以最终还是选择了自定义光标


<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@android:color/black" />
    <size android:width="2dip" />
shape>

取消底部线

如果要取消TextInputEditText底部线,在EditText中我们设置background=@null,但是TextInputEditText不同,我们需要将TextInputLayoutTextInputEditbackgound都设置为@null

<android.support.design.widget.TextInputLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@null">

  <android.support.design.widget.TextInputEditText
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="@null"
      android:hint="请输入手机号码"
      android:padding="8dp"/>

android.support.design.widget.TextInputLayout>

你可能感兴趣的:(android,Material)