Question

In situation below, TextView background should be solid color, but instead i get it transparent somehow.. so on listview scroll, listview content is visible through textview, but it should not.

Here is my layout:

<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>

What is wrong here :) ?

transparent TextView

Was it helpful?

Solution

Try swapping the two items in your FrameLayout. I suspect that the ListView is in fact transparent, and your TextView is under it.

Some more information is available from this SO question: Placing/Overlapping(z-index) a view above another view in android

OTHER TIPS

I guess the problem with the color you used for background.

<TextView
   android:background="#AARRGGBB" />

Above AA is for alpha channel, RR for red, GG for green and BB for blue. Here is the Hex Opacity Values that you can used for AA:

100% — FF 95% — F2 90% — E6 85% — D9 80% — CC 75% — BF 70% — B3 65% — A6 60% — 99 55% — 8C 50% — 80 45% — 73 40% — 66 35% — 59 30% — 4D 25% — 40 20% — 33 15% — 26 10% — 1A 5% — 0D 0% — 00

Try to change the color according to given format and see still the problem is happening there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top