kenik
kenik

Reputation: 316

Style attribute 'android:attr/colorControlNormal>' not found - cannot find mistake in source code

I have an error : error: style attribute 'android:attr/colorControlNormal>' not found.

There you have activity_main :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">


<RelativeLayout
    android:layout_centerInParent="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/section_convert"
        android:orientation="horizontal"
        android:layout_centerHorizontal="true"
        android:layout_width="match_parent"
        android:layout_height="150dp"
        >

        <RadioGroup
            android:id="@+id/radioGroup"
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <RadioButton
                android:id="@+id/coin2coin"
                android:text="Coin To Coin"
                android:theme="@style/MyRadioButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <RadioButton
                android:id="@+id/money2coin"
                android:text="Money To Coin"
                android:theme="@style/MyRadioButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <RadioButton
                android:id="@+id/coin2money"
                android:text="Coin To Money"
                android:theme="@style/MyRadioButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </RadioGroup>


    </LinearLayout>

    <LinearLayout
        android:layout_below="@id/section_convert"
        android:id="@+id/section_text"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:text="From"
            android:textSize="16sp"
            android:textColor="@color/colorAccent"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <com.jaredrummler.materialspinner.MaterialSpinner
            android:id="@+id/fromSpiner"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            app:ms_background_color="@color/colorPrimary"
            app:ms_text_color="@color/colorAccent"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <TextView
            android:text="To"
            android:textSize="16sp"
            android:textColor="@color/colorAccent"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <com.jaredrummler.materialspinner.MaterialSpinner
            android:id="@+id/toSpinner"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            app:ms_background_color="@color/colorPrimary"
            app:ms_text_color="@color/colorAccent"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

    </LinearLayout>

    <Button
        android:id="@+id/btnConvert"
        android:text="CONVERT"
        android:layout_below="@id/section_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <android.support.v7.widget.CardView
        android:layout_below="@id/btnConvert"
        android:layout_margin="16dp"
        app:cardElevation="4dp"
        android:padding="8dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:weightSum="10"
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/coinImage"
                android:layout_weight="1"
                android:layout_width="0dp"
                android:layout_height="50dp" />

            <TextView
                android:textSize="20sp"
                android:textColor="@color/colorAccent"
                android:layout_weight="9"
                android:layout_gravity="center_vertical"
                android:layout_width="0sp"
                android:layout_height="wrap_content"
                />

        </LinearLayout>


    </android.support.v7.widget.CardView>


</RelativeLayout>

styles.xml

<resources>

    <!-- Base application theme. -->
    <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/colorAccent</item>
    </style>

    <style name="MyRadioButton" parent="Theme.AppCompat.Light">
        <!-- there i got a message : "cannot resolve a symbol ---> 
        <item name="android:colorControlNormal>">@color/colorPrimary</item>
        <item name="android:colorControlActivated">@color/colorAccent</item>
    </style>

</resources>

I have no idea what I'm doing wrong. It worked fine until i added "Convert" Button but even if I remove that program still doesn't work. If you need more code just let me know but i think what I put is neccesary.

Upvotes: 10

Views: 6407

Answers (2)

Naimur Hasan
Naimur Hasan

Reputation: 685

In flutter the reason could be not because of adding, app/build.gradle

dependencies {
    implementation 'androidx.appcompat:appcompat:1.3.1'
    .......
}

Upvotes: 14

steevoo
steevoo

Reputation: 631

remove android from name use it like that

 <item name="colorControlNormal>">@color/colorPrimary</item>

remove the second > from the name

"colorControlNormal>">

Upvotes: 5

Related Questions