Home > OS >  How to horizontally center "Label hint" in TextInputLayout?
How to horizontally center "Label hint" in TextInputLayout?

Time:10-27

Image of textinputlayout

In the above image how can I horizontally center the "Label" ?

CodePudding user response:

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@ id/inputAddress"
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/_8sdp"
                    android:hint="@string/postal_address"
                    android:textSize="@dimen/_10sdp"
                    >

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@ id/edtAddress"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:gravity="center"
                        android:text="adas"
                        android:textSize="@dimen/_10sdp" />

                </com.google.android.material.textfield.TextInputLayout>
  • Related