问题
I have set a text input floating button But it shows the floating label outside the input box. How can I show inside the input box in android?
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/text_input_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColorHint="@color/white_new"
app:hintTextAppearance="@style/TextAppearance.App.TextInputLayout"
android:hint="@string/label">
<EditText
android:id="@+id/et_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:padding="12dp"
android:gravity="left"
android:focusable="true"
android:focusableInTouchMode="true"
android:background="@drawable/edit_textinput_box"
android:layout_marginBottom="25dp"
android:hint="@string/name"
android:inputType="placeholder"
android:textColor="@color/white_new"
android:textColorHint="@color/white_new" />
</com.google.android.material.textfield.TextInputLayout>
来源:https://stackoverflow.com/questions/65367815/floating-label-needs-to-show-inside-the-textinput-layout-in-android-studio