[英]TextInputLayout remove unwanted space
我想要沒有任何邊框和框的TextInputLayout,所以我將以下代碼用於
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/app_name"
app:boxBackgroundMode="none"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
但是我不知道什么時候寫
app:boxBackgroundMode =“ none”
到TextInputLayout,那么大小是自動拉伸,如果您發現有關此plz的任何解決方案,這看起來很奇怪,請幫助我。
這是我的輸出的屏幕截圖
這是因為app:boxBackgroundMode="none"
嘗試按照以下代碼來實現您的設計
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:backgroundTint="@color/white"
app:boxStrokeColor="@color/white"
app:boxBackgroundColor="@color/white"
android:background="@color/white"
android:hint="@string/app_name">
<EditText
android:background="@color/white"
android:backgroundTint="@color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.