1

使用新的材料设计指南,我正在尝试创建一个概述的文本字段。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:padding="10dp">

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:boxStrokeWidth="2dp"
    app:boxStrokeColor="@color/colorPrimary"
    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">

    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</com.google.android.material.textfield.TextInputLayout>

结果没有轮廓或外观变化。Android Studio 确实会引发渲染问题。'无法解析资源 @string/path_password_strike_through' 。我试图重建和清理项目但没有运气。

任何想法都会很棒,谢谢。

4

1 回答 1

2

我有同样的问题,添加这个app:passwordToggleDrawable="@string/your_string"和一个错误,同时渲染TextInputLayoutCouldn't resolve resource @string/path_password_strike_through已经消失了。

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:boxStrokeWidth="2dp"
    app:boxStrokeColor="@color/colorPrimary"
    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
    app:passwordToggleDrawable="@string/your_string">
于 2018-11-26T03:41:10.270 回答