[英]Call requires API level 11 (current min is 8): android.widget.EditText#setAlpha
I want to make my EditText Opacity to 1
which will ensure that it looks like disabled. 我想将我的
EditText Opacity to 1
,以确保它看起来像已禁用。 But since my API level is set to 8, i am not able to apply this method. 但是由于我的API级别设置为8,所以我无法应用此方法。
Is there anyway we can disable the EditText and Grey it out
, so that i looks disabled. 无论如何,我们可以禁用
EditText and Grey it out
,以便我看起来已禁用。
尝试:
editText.setEnabled(false);
Yes, you can use setEnabled(false)
and then apply this kind of style on the button (in the layout xml file): 是的,您可以使用
setEnabled(false)
,然后在按钮上(在布局xml文件中)应用这种样式:
<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. 编辑:您将在这里找到所有想要学习如何在任何UI元素上应用样式的内容: http : //www.devahead.com/blog/2011/08/creating-a-custom-android-button-with-a -resizable-skin /该示例是关于按钮的,但是对于其他任何视图,它都是完全相同的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.