Wie behebe ich diesen Fehler? Im Grunde überlappt das Bild den Text. Können wir das in XML beheben?Android: Wie das Bild zu beheben, das meinen Text überlappt?
Hier ist der Code (natürlich ist es unvollständig).
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFCC0000"
>
<TextView
android:background="#55000000"
android:id="@+id/centerButton"
android:text="RELATIVE LAYOUT RULES!"
android:textSize="33dp"
android:textColor="#FFFFFF"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
<Button
android:layout_margin="40dp"
android:padding="20dp"
android:layout_below="@+id/centerButton"
android:layout_centerInParent="true"
android:text="PUSH ME!"
android:textSize="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button4" />
<ImageView
android:scaleType="centerInside"
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/Cat"
android:layout_above="@+id/centerButton"
android:layout_alignParentStart="true"
android:layout_marginBottom="39dp" />
</RelativeLayout>
Dies könnte helfen: https://StackOverflow.com/Questions/19065232/Placing-A-Textview-on-Top-of-imageview-in-Android – zb22
@Xedon können Sie teilen @ Drawable/Cat Bild –
aussieht Ihre Textansicht befindet sich hinter der Bildansicht. Versuchen Sie, die Textansichtscodes unterhalb der Bildansicht in der XML-Datei zu platzieren. was bringt die Textansicht an die Vorderseite des Bildes – Simo