Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use "disableAlpha" with EditText / How to change attribute in AttributeSet

I want my Edittext to grey-out less or more than standard when disabled with editTxtV.setEnabled(false). Oviously the disableAlpha-Property does exactly this. But using android:disabledAlpha="2.0" like this in layout.xml

<EditText android:inputType="numberDecimal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/EditTextV" android:text="1" android:disabledAlpha="2.0" ></EditText>

do not change the behaviour at all.

Hot do I correctly change "how much to grey out"?

Sebastian

PS: One idea is to make a custom View extending EditText. In the constructor I get attrs AttributeSet and give that back to super.constructor, but how to change the disableAlpha-attribute on its way through my constructor?

like image 306
Sebastian Avatar asked Nov 15 '22 02:11

Sebastian


1 Answers

Alpha values should range from 0.0 to 1.0, any values greater than 1.0 is considered as 1.0.

like image 146
Ragunath Jawahar Avatar answered Dec 18 '22 19:12

Ragunath Jawahar