Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android:state_enabled missing/not working?

I do not have the property android:state_enabled for any of the controls. Typing it manually doesn't work either. I can only use the deprecated android:enabled.

I have the latest everything.

like image 898
Monstieur Avatar asked Mar 02 '10 05:03

Monstieur


2 Answers

See this answer from a similar thread: it says android:enabled is not actually deprecated, it's just an Eclipse error.

https://stackoverflow.com/a/6919200/813810

like image 125
Diego Avatar answered Nov 05 '22 22:11

Diego


How exactly are you using the state_enabled property?
It is a read-only property to check if the view is enabled, not to set the view as enabled/disabled! Please check http://developer.android.com/reference/android/graphics/drawable/StateListDrawable.html

As an example, I am using the following code that works since Android 1.5, check if it works for you:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
   <item android:state_enabled="false" android:drawable="@drawable/image_disabled" />
   <item android:drawable="@drawable/image_enabled" />
</selector>
like image 45
pandre Avatar answered Nov 05 '22 23:11

pandre