Android 2.2的 - 如何设置一个微调的alpha属性? [英] Android 2.2 - how do i set an spinner's alpha property?
本文介绍了Android 2.2的 - 如何设置一个微调的alpha属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图做一个微调完全透明的。在Android 4.0的我能做到这一点的XML布局设计设置alpha属性设置为0。但是,当我与Android 2.2的工作,我不能使用该属性时,Eclipse将其标记为一个错误,并告诉我,我不能使用它。
I'm trying to make a spinner totally transparent. In Android 4.0 I can do this setting the alpha property to 0 in the xml layout designer. But when I work with Android 2.2 i can't use that property, Eclipse mark it as an error and tell me that i can't use it.
我试图使它透明书面方式这个Java code:
I tried to make it transparent writting this java code:
final Spinner cmbCategorias = (Spinner) findViewById(R.id.cmbCategorias);
cmbCategorias.getBackground().setAlpha(0);
和它的作品,但在微调文本保持可见。
and it works, but the text in the spinner keeps visible.
有人能告诉我,我能做些什么?
谢谢
Someone can tell me what can i do?? Thanks
推荐答案
使XML布局像spinner_textview.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/txtview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:textColor="@android:color/transparent" />
并添加以下Java中code:
Spinner sp=(Spinner)findViewById(R.id.sp);
sp.setAdapter(new ArrayAdapter(this,R.layout.spinner_textview,
items));
这篇关于Android 2.2的 - 如何设置一个微调的alpha属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文