2016-03-21 48 views
0

私は現在、私が持っている仕事のためにバンドアプリを作っていますが、バンドメンバーに画像が表示されるカードビューを作っていますが、カードビューの外に出て、たとえば画像ビューを追加すると、カードビューとその内容は消えます。何か案は?画像が追加されたときにカードビューが消える

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

答えて

0

あなたのLinearLayoutの向きは水平であり、あなたはcardviewが画面の外に水平事が手伝っ

+0

おかげとなりますので、自動的に画像の一致親幅を作ります。画像が画面の下側に画像を押し込んでいます。それはなぜですか? – DinoArmadillo

関連する問題