Android TextView背景透明,但应为纯色
在下面的情况下,TextView背景应该是纯色的,但我以某种方式使其透明。。所以在listview滚动上,listview内容可以通过textview看到,但不应该 以下是我的布局:Android TextView背景透明,但应为纯色,android,textview,transparency,Android,Textview,Transparency,在下面的情况下,TextView背景应该是纯色的,但我以某种方式使其透明。。所以在listview滚动上,listview内容可以通过textview看到,但不应该 以下是我的布局: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_h
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:id="@+id/listSection"
android:textSize="19sp"
android:textColor="@android:color/black"
android:text="Medium Text"
android:background="#707e89"
android:padding="5dp"
android:textStyle="bold"
android:autoText="true" />
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/medicationList"
android:layout_gravity="center_horizontal|top" />
</FrameLayout>
这里怎么了:)
尝试交换
框架布局中的两个项目。我怀疑ListView
实际上是透明的,而您的TextView
就在它下面
从这个问题中可以获得更多信息:我想你使用的背景颜色有问题
<TextView
android:background="#AARRGGBB" />
上面AA代表阿尔法通道,RR代表红色,GG代表绿色,BB代表蓝色。
以下是可用于AA的十六进制不透明度值:
100%-FF
95%-F2
90%-E6
85%-D9
80%-CC
75%高炉
70%-B3
65%-A6
60% — 99
55%-8摄氏度
50% — 80
45% — 73
40% — 66
35% — 59
30%-4D
25% — 40
20% — 33
15% — 26
10%-1A
5%-0D
0%-00
尝试根据给定的格式更改颜色,然后仍然可以看到问题发生在那里 是的,这就是问题所在。后来我自己意识到了这一点,但我们仍然可以讨论这个问题。“z索引由项目的添加顺序定义”。因此,如果首先添加TextView,那么它应该显示在所有其他组件的上方?布局中的最后一个项目是最高的项目,反之亦然。不需要太多的争论:)这是我尝试过的第一件事,但如果你再仔细想想,“#707e89”是纯色,不包括透明度,所以你不能让它像现在这样透明:)。见上文关于anwser的讨论(@NasaGeek)。