0
的兒童
我layout.xml代碼:的Android TextView中不顯示(RelativeLayout的
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="cards main container">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="210dp"
card_view:cardBackgroundColor="@color/color_white"
card_view:cardCornerRadius="10dp"
card_view:cardElevation="5dp"
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<TextView
android:id="@+id/match_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:paddingStart="30dp"
android:paddingTop="10dp"
tools:text="2nd ODI"/>
<TextView
android:id="@+id/match_series_separator"
android:layout_toRightOf="@+id/match_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:paddingTop="10dp"
android:paddingStart="5dp"
android:text="-"
/>
<TextView
android:id="@+id/series_name"
android:layout_toRightOf="@+id/match_series_separator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:paddingStart="5dp"
android:paddingTop="10dp"
tools:text="India Tour of SriLanka,5 ODIs,2010"
/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<ImageView
android:id="@+id/team_logo_1"
android:tag="image_tag"
android:layout_alignParentStart="true"
android:layout_width="65dp"
android:layout_height="100dp"
android:layout_margin="5dp"
android:src="@drawable/matches"/>
<TextView
android:id="@+id/score_team_1"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
tools:text="100/3"
android:layout_toEndOf="@+id/team_logo_1"/>
<TextView
android:id="@+id/overs_team_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:paddingTop="50dp"
android:paddingStart="15dp"
tools:text="20"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/team_logo_1" />
<ImageView
android:id="@+id/team_logo_2"
android:layout_alignParentEnd="true"
android:tag="image_tag"
android:layout_width="65dp"
android:layout_height="100dp"
android:layout_margin="5dp"
android:src="@drawable/matches"/>
<TextView
android:id="@+id/score_team_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:textSize="20sp"
tools:text="100/3"
android:layout_toStartOf="@+id/team_logo_2"/>
<TextView
android:id="@+id/overs_team_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/score_team_2"
android:layout_centerVertical="true"
android:textSize="20sp"
android:paddingTop="50dp"
android:paddingEnd="15dp"
android:layout_toStartOf="@+id/team_logo_2"
tools:text="20"/>
</RelativeLayout>
<TextView
android:id="@+id/match_status_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
tools:text="Match in progress/ India won by 3 wickets"/>
<TextView
android:id="@+id/target_leadby"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:layout_gravity="center_horizontal"
tools:text="Target 189/lead by 100"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
<TextView
android:paddingTop="30dp"
android:layout_below="@+id/card_view"
android:id="@+id/match_preview_summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="10"
android:textColor="@android:color/black"
android:ellipsize="end"
android:textSize="15sp"
android:text="Description of the match thats about to start cause people love to read "/>
</RelativeLayout>
ScreenShot from android studio
這就是圖像如何在Android工作室,但只有cardViews
正在手機,而不是上顯示TextView
ID爲android:layout_below="@+id/card_view"
使用LinearLayout
於事無補了。
更改android:layout_height="wrap_content"
父RelativeLayout
給出了相同的結果都顯示
的CardView
的
所有的內容,如果android:layout_below="@+id/card_view"
除去TextView
顯示背後的CardView
您應該只在卡片視圖中有一個子組視圖,您已添加兩個孩子** RelativeLayout **和** LinearLayout **,它們將相互重疊,因此只添加一個組視圖將解決您的問題; ) –