【问题标题】:Outlined TextInputLayout Not rendering properly概述的 TextInputLayout 未正确呈现
【发布时间】:2019-02-06 01:39:01
【问题描述】:

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

<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' 。我试图重建和清理项目但没有运气。

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

【问题讨论】:

    标签: android material-design textfield androidx


    【解决方案1】:

    我遇到了同样的问题,添加此 app:passwordToggleDrawable="@string/your_string" 并在渲染 TextInputLayout 时出现错误,显示 Couldn'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">
    

    【讨论】:

      猜你喜欢
      • 2021-07-07
      • 2020-11-30
      • 1970-01-01
      • 2018-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多