I want to make my EditText Opacity to 1
which will ensure that it looks like disabled. But since my API level is set to 8, i am not able to apply this method.
Is there anyway we can disable the EditText and Grey it out
, so that i looks disabled.
Try:
editText.setEnabled(false);
Yes, you can use setEnabled(false)
and then apply this kind of style on the button (in the layout xml file):
<item android:state_enabled="false" >
<shape>
<gradient
android:endColor="#007900"
android:startColor="#009A77"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#F1FAFE" />
<corners
android:radius="5dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
Customise the values with colors and effects you want.
Edit: You will find everything you want to learn how to apply a style on any UI element here: http://www.devahead.com/blog/2011/08/creating-a-custom-android-button-with-a-resizable-skin/ The example is about buttons but it is the exact same method for any other view.