我想创建一个有吸引力的用户界面。我想在edittext周围创建一个矩形框。我怎么才能做到呢?
发布于 2020-10-15 14:46:43
只需使用带有OutlinedBox样式的标准TextInputLayout:
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="TEXT"/>
</com.google.android.material.textfield.TextInputLayout>

您可以使用boxStrokeWidth和boxStrokeColor来更改宽度和颜色。
<com.google.android.material.textfield.TextInputLayout
app:boxStrokeColor="@color/xxxx"
app:boxStrokeWidth="2dp"https://stackoverflow.com/questions/64363747
复制相似问题