【问题标题】:How to horizontally center "Label hint" in TextInputLayout?如何在 TextInputLayout 中水平居中“标签提示”?
【发布时间】:2021-12-11 04:40:43
【问题描述】:

Image of textinputlayout

在上图中,如何将“标签”水平居中?

【问题讨论】:

标签: android xml android-layout android-textinputlayout


【解决方案1】:
                <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>

【讨论】:

    猜你喜欢
    • 2013-11-12
    • 1970-01-01
    • 2012-12-27
    • 1970-01-01
    • 1970-01-01
    • 2016-09-10
    • 1970-01-01
    • 2010-11-20
    • 1970-01-01
    相关资源
    最近更新 更多