android - Android:带有一个编辑文本和微调器的 TextInputLayout
问题描述
我想在 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>
解决方案
执行
'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>
根据要求调整宽度尺寸。
推荐阅读
- django - Django 组仅使用 users_id 并从模型中获取所有其他字段
- python - 在下面的模型中,我应该对 LSTM 的 input_shape 取什么值
- visual-studio-code - 运行 Rust 程序时,VS Code 说“msbuild : 术语 'msbuild' 无法识别......”?
- react-admin - 如果出现服务器端错误,请留在编辑页面
- javascript - 产品和价格的动态项目选择
- oracle-ebs - 我们可以从哪里检索 Oracle-EBS 中的可用承诺日期的 next_available_date?
- java - 如何从警报对话框中的按钮开始新活动?
- r - 我们如何使用 `order()` 或替代方法在闪亮的应用程序中对 `reactiveVal` `data.frame` 进行排序?
- marklogic - 从 9.0-8 升级到 9.0-10 时不兼容?
- blockchain - 有没有可能在 Corda 中添加多个对等点?