小编mor*_*bio的帖子

如何更改 TextInputLayout 提示文本的背景颜色

我正在编写 TextInputLayout 的视图

我的 style.xml 是:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="MyTextInputLayoutStyle" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
        <item name="boxStrokeColor">@color/colorPrimary</item>
        <item name="hintTextColor">@color/colorPrimary</item>
        <item name="boxBackgroundColor">@android:color/white</item>
        <item name="boxStrokeWidth">2dp</item>
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

我在 color.xml 中的颜色覆盖是:

<color name="mtrl_textinput_default_box_stroke_color" tools:override="true">#c2261a</color>
Run Code Online (Sandbox Code Playgroud)

我的文本输入布局是:

<com.google.android.material.textfield.TextInputLayout
        android:id="@+id/weightInput"
        style="@style/MyTextInputLayoutStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        android:layout_marginBottom="15dp"
        android:hint="@string/hint_weight"
        app:errorEnabled="true"
        app:helperTextEnabled="false"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textViewTitle">

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:imeOptions="actionDone"
            android:importantForAutofill="no"
            android:inputType="numberDecimal"
            android:maxLength="5"
            android:maxLines="1"
            android:singleLine="true"
            android:textAlignment="center"
            android:textColor="@color/colorPrimary" />

    </com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

最终结果是

最后结果

我们可以看到提示文本的背景颜色是透明的。我怎样才能找到那个视图。

我尝试了这种风格但没有成功:

我的 style.xml …

android material-design android-textinputlayout

4
推荐指数
1
解决办法
4935
查看次数

如何在default.vcl清漆中创建自定义功能?

我在我的vcl中有重复的代码,我想创建自定义函数而不嵌入内联C代码.有可能的?

非常感谢您的阅读!最好的祝福

varnish varnish-vcl

1
推荐指数
1
解决办法
1706
查看次数

升级 MacOs 和 Xcode 时 Carthage 更新失败,退出代码为 1

升级您的操作系统和/或 Xcode 后。

当你跑步时

$ carthage update --platform iOS --no-use-binaries
Run Code Online (Sandbox Code Playgroud)

你会得到如下输出:

正在获取 FooLibrary

shell 任务 (/usr/bin/env git fetch --prune --quiet https://github.com/foodeveloper/FooLibrary.git refs/tags/ :refs/tags/ +refs/heads/ :refs/heads/(在 /Users/yourUser/Library/Caches/foo.package/dependencies/FooLibrary 中启动)失败,退出代码为 1

xcode swift carthage

1
推荐指数
1
解决办法
2868
查看次数