D
D
Denis2017-06-07 20:39:02
css
Denis, 2017-06-07 20:39:02

Why doesn't android:theme work for TextInputLayout in android 4.4?

For some reason, android:theme does not work for TextInputLayout in android 4.4.

<android.support.design.widget.TextInputLayout
                        android:id="@+id/text_input_project_name"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:hint="@string/Name_project"
                        android:theme="@style/EditTextInputAddContactProject">

                        <EditText
                            android:id="@+id/name_project_create"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_alignParentEnd="true"
                            android:layout_alignParentLeft="true"
                            android:layout_alignParentRight="true"
                            android:layout_alignParentStart="true"
                            android:layout_alignParentTop="true"
                            android:inputType="textMultiLine"
                            android:text="sdsd"
                            android:textColorHint="@color/color_gray_text"
                            app:backgroundTint="@color/color_gray_text"
                            android:backgroundTint="@color/color_gray_text"
                            android:textIsSelectable="false" />
                    </android.support.design.widget.TextInputLayout>

Here is the style I am using
<style name="EditTextInputAddContactProject">
        <item name="colorPrimary">#ff0400</item>
        <item name="colorPrimaryDark">#00ff04</item>
        <item name="colorAccent">#0055ff</item>
        <item name="colorControlHighlight">#ff0400</item>
        <item name="android:textColorHint">#ffea00</item>
        <item name="android:cacheColorHint">#00ff04</item>
        <item name="android:textSize">20sp</item>
        <item name="colorControlNormal">#00ff04</item>
        <item name="colorControlActivated">#00ff04</item>
        <item name="android:textColorHighlight">#ff0400</item>
        <item name="android:textColorLink">#ff0400</item>
        <item name="android:textColorSecondary">#ff0400</item>
    </style>

Clarification:
There is a global style that is included in the manifest, and if the layout markup (in which the problem described above) is used in an activity, then the problem remains, but if the same layout is used in a fragment, then there is no problem.
Style:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/white</item>
        <item name="android:textColorSecondary">@color/white</item>
        <item name="colorControlHighlight">#277dd3</item>
    </style>

Manifesto:
<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:name=".utils.App"
        android:theme="@style/AppTheme"> <!-- Глобальный стиль-->

What is the problem and how to fix it?
I use an emulator to test.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hakito, 2017-06-08
@hakito

Try app:theme="@style/...."

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question