我想在TextInputLayout中添加一个微调器,并像这样显示TextInputEditText的提示。
我尝试制作自定义TextInputLayout,但仍然无法为其添加微调器。
我添加了带有轮廓视图的TextInputLayout:-
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:textColorHint="@color/colorGreyView"
android:textSize="20dp"
style="@style/Widget.MaterialComponents.Button.OutlinedButton">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile Number"/>
</com.google.android.material.textfield.TextInputLayout>
答案 0 :(得分:0)
实现
'com.google.android.material:material:1.1.0-alpha08'
将TextInputLayout ExposedDropdownMenu
与EditextText一起使用,然后尝试以下操作:
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Label"
app:errorEnabled="true">
<AutoCompleteTextView
android:id="@+id/filled_exposed_dropdown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:editable="false" />
<com.google.android.material.textfield.TextInputEditText
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
根据要求调整宽度大小。