作为Edittext
,它不是组小部件中唯一的一个。使用TextInputLayout
提示不起作用。告诉我有什么方法可以召唤帮助吗?
这是我的布局:
<android.support.design.widget.TextInputLayout
android:id="@+id/til_account"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:textColorHint="@color/colorTextHint">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/et_account_tint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorTextHint"
android:maxLines="1"
android:theme="@style/EditText"
android:textSize="16sp" />
<EditText
android:id="@+id/et_account"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:drawableRight="@mipmap/ic_selectcontact"
android:hint="@string/enter_phone_number_contact_name"
android:inputType="text"
android:maxLines="1"
android:textColorHint="@color/colorTextHint"
android:textSize="16sp"
android:theme="@style/EditText" />
<TextView
android:id="@+id/et_account_button"
android:layout_width="70dp"
android:layout_height="35dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@android:color/transparent"
android:onClick="@{presenter::onClick}"
android:textSize="16sp"
tools:ignore="LabelFor" />
</RelativeLayout>
</android.support.design.widget.TextInputLayout>
答案 0 :(得分:1)
Do like this
<android.support.design.widget.TextInputLayout
android:id="@+id/til_account"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
app:hintEnabled="true" app:hintAnimationEnabled="false"
android:textColorHint="@color/colorTextHint">
<EditText
android:id="@+id/et_account_tint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorTextHint"
android:maxLines="1"
android:theme="@style/EditText"
android:textSize="16sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/til_account"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
app:hintEnabled="true"
app:hintAnimationEnabled="false"
android:textColorHint="@color/colorTextHint">
<EditText
android:id="@+id/et_account"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:drawableRight="@mipmap/ic_selectcontact" android:hint="@string/enter_phone_number_contact_name"
android:inputType="text"
android:maxLines="1"
android:textColorHint="@color/colorTextHint"
android:textSize="16sp"
android:theme="@style/EditText" />
</android.support.design.widget.TextInputLayout>
<TextView
android:id="@+id/et_account_button"
android:layout_width="70dp"
android:layout_height="35dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@android:color/transparent"
android:onClick="@{presenter::onClick}"
android:textSize="16sp"
tools:ignore="LabelFor" />