Ich habe ein Layout mit einem Textview wie folgt aus:Textview Hintergrundfarbe mit übergeordneten Element Hintergrundfarbe gemischt
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/contentColorBackground"
android:backgroundTint="@color/contentColorBackground"
android:orientation="vertical" >
<TextView
android:id="@+id/Anecdote_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:padding="10dp"
android:gravity="center"
android:text="Click Me"
android:textAppearance="@android:style/TextAppearance.Medium"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:background="@drawable/categories_button"
xmlns:android="http://schemas.android.com/apk/res/android" />
Es nutzt die ziehbar als Hintergrund:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape android:shape="rectangle" >
<corners android:radius="3dip" />
<stroke android:width="1dip" android:color="@color/anecdoteBorderLine" />
<gradient android:angle="-90" android:startColor="@color/anecdoteStartTopColor" android:endColor="@color/anecdoteEndBottomColor" />
</shape>
</item>
<item android:state_focused="true">
<shape android:shape="rectangle" >
<corners android:radius="3dip" />
<stroke android:width="1dip" android:color="#f22121" />
<solid android:color="#b5ffaf10"/>
</shape>
</item>
<item >
<shape android:shape="rectangle" >
<corners android:radius="3dip" />
<stroke android:width="1dip" android:color="@color/anecdoteBorderLine" />
<gradient android:angle="-90" android:startColor="@color/anecdoteStartTopColor" android:endColor="@color/anecdoteEndBottomColor" />
</shape>
</item>
</selector>
Alles scheint in Ordnung, aber es ist ein großes Problem, die Hintergrundfarbe von Linear Layout erscheint gemischt mit der Farbe von TextView. Das ist nicht das, was ich will, ich möchte, dass das TextView nur die Farbe des Zeichens hat, wie es Hintergrund ist. Was ist der richtige Weg für mich, das zu tun?
Danke für die Hilfe!
setzen Sie die Hintergrundfarbe des linearen Layouts auf transparent. –
Ich denke, Sie haben ein Problem mit der Transparenz in Ihrem TextView. Die ersten beiden Zeichen nach dem Hash-Tag definieren die Transparenz. Sie müssen die mit 8 Zahlen definierten Farben ändern .... – Opiatefuchs