Jim Finnis
Jim Finnis

Reputation: 21

Can't get theme attribute references to work in android

I'm very new (second day!) to android and working my way through the dev guide. There, it says that you can reference attributes inside the current theme from your XML by using the form "?...", for example

<?xml version="1.0" encoding="utf-8"?>
<EditText id="text"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:textColor="?android:textDisabledColor"
    android:text="@string/hello_world" />

If I try to build this, I just get "No resource found that matches the given name (at 'textColor' with value '?android:textDisabledColor')

Given that this seems pretty basic stuff, and yet I can't find any references to similar problems elsewhere, I must be missing something obvious or misunderstanding something simple. Can anyone tell me what it is?

Upvotes: 2

Views: 1775

Answers (2)

sham
sham

Reputation: 1356

I don't think textDisabledColor exists anymore - at least not in the newer SDKs which is probably why it can't be found. Try textColorSecondary instead - e.g.

android:textColor="?android:attr/android:textColorSecondary"

Unfortunately I cant figure out if theres a specific disabled color. I came across the site below which seems to define the default theme: See this link for definition of default theme

Upvotes: 2

tbruyelle
tbruyelle

Reputation: 13045

try android:textColor="?android:attr/textDisabledColor"

Upvotes: 0

Related Questions