简体   繁体   English

调用需要API级别11(当前最小值为8):android.widget.EditText#setAlpha

[英]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.

相关问题 setAdapter“调用需要API级别11(当前最小值为8):android.widget.AbsListView #setAdapter”? - setAdapter “Call requires API level 11 (current min is 8): android.widget.AbsListView#setAdapter”? 调用需要API级别11(当前最小值为1) - Call requires API level 11 (current min is 1) 呼叫需要API级别14(当前最小值为11) - Call requires API level 14 (current min is 11) 调用需要API级别11(当前最小值为8):android.app.Activity#invalidateOptionsMenu - Call requires API level 11 (current min is 8): android.app.Activity#invalidateOptionsMenu 调用需要API级别16(当前最小值为10):android.widget.ImageView#getMaxWidth - Call requires API level 16 (current min is 10): android.widget.ImageView#getMaxWidth 调用需要 API 级别 29(当前最小值为 21):`android.widget.NumberPicker#setTextColor` - Call requires API level 29 (current min is 21): `android.widget.NumberPicker#setTextColor` 调用需要API级别11(当前最小值为9)android.app.Activity#onCreateView - Call requires API level 11(current min is 9) android.app.Activity#onCreateView 调用需要API级别11(当前最小值为8):new android.app.AlertDialog.Builder - Call requires API level 11 (current min is 8): new android.app.AlertDialog.Builder android:editTextBackground需要API级别11(当前最小值为7) - android:editTextBackground requires API level 11 (current min is 7) ?android:attr / selectableItemBackground`需要API级别11(当前最小值为10) - ?android:attr/selectableItemBackground` requires API level 11 (current min is 10)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM