【发布时间】:2021-10-25 10:47:41
【问题描述】:
我在文本输入布局中有一个前缀文本,但它仅在我单击文本输入编辑文本内时显示,该文本输入布局位于具有我的前缀文本的文本输入布局内。如何使前缀文本始终与提示一起显示
下面是我的文本输入编辑文本
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_number"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/til_country"
android:layout_marginStart="30dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="10dp"
android:padding="5dp"
app:boxBackgroundColor="#EFEFF2"
app:prefixText="+01 - "
app:shapeAppearanceOverlay="@style/RoundedTextInputLayout">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_first_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:hint="@string/number"
android:inputType="phone"
android:maxLength="100"
android:textSize="15sp" />
</com.google.android.material.textfield.TextInputLayout>
我想要实现的是
+01 - 
前缀中的上述文本应始终显示
我已尝试执行以下操作
app:prefixTextColor="@color/secondaryDarkColor"
【问题讨论】:
标签: android-studio prefix android-textinputlayout textinputlayout