如何同时使用样式和主题属性?

时间:2020-03-14 15:35:44

标签: android

我需要实施 具有自定义标签颜色的OutlinedBox文本输入。但这似乎是不可能的。

<style name="LoginTextInputLayoutStyle" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
    <item name="boxStrokeColor">@color/colorAccent</item>
    <item name="boxStrokeWidth">2dp</item>

</style>



<style name="Theme2" parent="AppTheme">
    <item name="colorPrimary">@color/colorAccent</item>

</style>


<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/password"
    android:layout_width="match_parent"
    android:layout_margin="10dp"
    android:layout_height="wrap_content"

    android:theme="@style/Theme2"
    style="@style/LoginTextInputLayoutStyle"
   >

    <com.google.android.material.textfield.TextInputEditText

        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:hint="Password"
        android:inputType="textPassword"
        style="@style/LoginEditText"
        />

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

看起来像是普通输入,样式不起作用。

0 个答案:

没有答案