[英]React Material UI: Textfield maxLength not working in Android
[英]TextField in Material Design UI Android
您可以使用:
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:placeholderText="Name"
app:startIconDrawable="@drawable/..."
app:startIconTint="@color/...."
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.rounded"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.google.android.material.textfield.TextInputLayout>
和:
<style name="ShapeAppearanceOverlay.App.rounded" parent="">
<item name="cornerSize">50%</item>
</style>
這就是使用材料設計 TextFiled 實現的方法
android:drawablePadding="16dp"
android:gravity="center"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
如果要實現圓形驗屍儀邊框設置
app:boxCornerRadiusBottomEnd="32dp"
app:boxCornerRadiusBottomStart="32dp"
app:boxCornerRadiusTopEnd="32dp"
app:boxCornerRadiusTopStart="32dp"
下面是代碼片段
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
app:boxCornerRadiusBottomEnd="32dp"
app:boxCornerRadiusBottomStart="32dp"
app:boxCornerRadiusTopEnd="32dp"
app:boxCornerRadiusTopStart="32dp"
app:boxStrokeColor="@color/color_red"
app:startIconDrawable="@drawable/ic_user">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="16dp"
android:gravity="center"
android:hint="hint"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.