2016-03-21 16 views
0

Ich mache gerade eine Band-App für ein paar Arbeiten und habe eine Kartenansicht gemacht, die die Bandmitglieder zusammen mit einem Bild zeigt, das funktioniert gut, aber nachdem ich es erstellt habe, wollte ich Sachen hinzufügen außerhalb der Kartenansicht und sobald ich zum Beispiel eine Bildansicht hinzufüge, verschwindet die Kartenansicht und ihr Inhalt. Irgendwelche Ideen?Kartenansicht verschwindet, wenn das Bild hinzugefügt wird

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout 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.package.test.band.MainActivity" 
    tools:showIn="@layout/app_bar_main" 
    android:orientation="horizontal"> 

<ImageView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/imageView" 
    android:src="@drawable/menu_bg_banner" /> 

<android.support.v7.widget.CardView 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_marginTop="150dp" 

> 
<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:padding="16dp" 

    > 
    <TextView 
     android:id="@+id/member1_name" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Member 1" 
     android:layout_alignParentTop="true" 
     android:textSize="30sp" 
     /> 
    <TextView 
     android:id="@+id/member1_job" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Guitar and Vocals" 
     android:layout_marginTop="40dp" 
     android:layout_below="@+id/member1_name" 
     android:layout_alignParentTop="true" 
     android:textSize="20sp" 
     /> 
    <ImageView 
     android:id="@+id/content_memeber1" 
     android:layout_toRightOf="@+id/member1_name" 
     android:scaleType="centerInside" 
     android:src="@drawable/content_member1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true"/> 
</RelativeLayout> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:padding="16dp" 
     android:layout_marginTop="115dp" 
     > 
     <TextView 
      android:id="@+id/member2_name" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="member2" 
      android:layout_alignParentTop="true" 
      android:textSize="30sp" 
      /> 
     <TextView 
      android:id="@+id/member2_job" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Bass" 
      android:layout_marginTop="40dp" 
      android:layout_below="@+id/member2_name" 
      android:layout_alignParentTop="true" 
      android:textSize="20sp" 
      /> 
     <ImageView 
      android:id="@+id/content_member2" 
      android:layout_toRightOf="@+id/member2_name" 
      android:scaleType="centerInside" 
      android:src="@drawable/content_member2" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true"/> 
    </RelativeLayout> 
    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:padding="16dp" 
     android:layout_marginTop="225dp" 
     > 
     <TextView 
      android:id="@+id/member3_name" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="member3" 
      android:layout_alignParentTop="true" 
      android:textSize="30sp" 
      /> 
     <TextView 
      android:id="@+id/member3_job" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Drummer" 
      android:layout_marginTop="40dp" 
      android:layout_below="@+id/member3_name" 
      android:layout_alignParentTop="true" 
      android:textSize="20sp" 
      /> 
     <ImageView 
      android:id="@+id/content_member3" 
      android:layout_toRightOf="@+id/member3_name" 
      android:scaleType="centerInside" 
      android:src="@drawable/content_member3" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true"/> 
    </RelativeLayout> 

Antwort

0

Ihre Linearlayout Ausrichtung ist horizontal und Sie Ihr Bild Match Mutter Breite machen so automatisch die cardview außerhalb des Bildschirms

wird
+0

Dank der horizontalen Sache geholfen. Das Bild wird jetzt weit über den Bildschirm geschoben. irgendwelche Ideen, warum das ist? – DinoArmadillo

Verwandte Themen