2016-08-07 19 views
0

Ich versuche, das weiße Bild auf der Rückseite meiner Schaltfläche und Text in Relative Layout zu senden. Hier ist der Code:Wie in Relative Layout Android Studio überlappen

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:context="com.example.sahni.lightspeed.starting_screen" 
tools:showIn="@layout/activity_starting_screen" 
android:background="@drawable/q1"> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/title" 
    android:textSize="70sp" 
    android:id="@+id/title" 
    android:textColor="#00e1ff" 
    android:layout_centerHorizontal="true" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentStart="true" /> 

<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/start_button" 
    android:id="@+id/button" 
    android:textSize="20sp" 
    android:layout_centerInParent="true" 
    android:layout_centerVertical="true" 
    android:layout_centerHorizontal="true" 
    android:onClick="buttonOnClick"/> 

<ImageView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/imageView" 
    android:layout_alignLeft="@+id/title" 
    android:layout_alignStart="@+id/title" 
    android:layout_below="@+id/title" 
    android:background="#ffffff" /> 
</RelativeLayout> 

Die Layout-Sets für das Bild nicht korrekt sind, aber ich weiß nicht, welche zu verwenden, um die Ausgabe Ich möchte zu bekommen. Ein Screenshot der aktuellen Ausgabe:

enter image description here

  • Bin ich das beste Layout für dieses Problem verwenden?
  • Kann mir bitte jemand erklären, wie die Lösung funktioniert? bewegen
+0

Können Sie bitte mehr ausarbeiten !, Wir bekommen es nicht, was Sie wollen! –

+0

@AkashDubey Ich versuche, die 'ImageView' hinter den' TextView' und 'Button' zu bekommen. –

Antwort

0

Gerade ersten ImageView in Ihrem RelativeLayout:

<RelativeLayout ... > 
    <ImageView ... /> 
    <TextView ... /> 
    <Button ... /> 
</RelativeLayout> 

Ihre ImageView hat android:layout_below="@+id/title" Eigenschaft es ist also immer unter Ihrem Titel, so dass es nicht im Hintergrund Ihres Titels sein.

+0

Sie sortiert Überlappungen, indem sie die Reihenfolge der Objekte im Code erkennt. –

+0

ja das ist es, Reihenfolge im Layout, Sichtbarkeitsreihenfolge einstellen (Hintergrund zu Vordergrund) – LaurentY

Verwandte Themen