我想創建TextInputLayout沒有下劃線和框邊緣之間的間隙可以消除這個間隙嗎?
圖片在這里:

<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@ id/tilSearch"
android:hint="@string/search_location"
app:errorEnabled="false"
app:errorTextColor="@color/red"
app:helperTextEnabled="true">
<EditText
android:id="@ id/edtSearch"
android:layout_width="match_parent"
android:layout_height="@dimen/_60dp"
android:importantForAutofill="no"
android:inputType="text"
tools:ignore="LabelFor" />
</com.google.android.material.textfield.TextInputLayout>
uj5u.com熱心網友回復:
您實際上可以使用這些屬性洗掉此下劃線,而不是洗掉間隙。消除間隙將在布局中創建雙線。所以改為洗掉那個間隙洗掉editText中的下劃線..
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/tilSearch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/search_location"
app:boxBackgroundColor="@null"
app:boxStrokeWidth="0dp"
app:boxStrokeWidthFocused="0dp"
app:errorEnabled="false"
app:errorTextColor="@color/red"
app:helperTextEnabled="true">
<EditText
android:id="@ id/edtSearch"
android:layout_width="match_parent"
android:layout_height="@dimen/_60dp"
android:background="@null"
android:importantForAutofill="no"
android:inputType="text"
tools:ignore="LabelFor" />
</com.google.android.material.textfield.TextInputLayout>
uj5u.com熱心網友回復:
我已經使用 scaleX 屬性解決了我的問題android:scaleX="1.02"。可能有更好的方法,但我找不到。
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@ id/tilSearch"
android:hint="@string/search_location"
app:errorEnabled="false"
app:errorTextColor="@color/red"
app:helperTextEnabled="true">
<EditText
android:id="@ id/edtSearch"
android:layout_width="match_parent"
android:layout_height="@dimen/_60dp"
android:importantForAutofill="no"
android:scaleX="1.02"
android:inputType="text"
tools:ignore="LabelFor" />
</com.google.android.material.textfield.TextInputLayout>
attr_android:scaleX
這將是結果: 結果
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/451122.html
標籤:安卓 安卓工作室 材料设计 材料组件-android 安卓文本输入布局
