2nd child linear layout will not appear

166 views Asked by At

I'm trying to setup two linear layouts - one set horizontally the other set vertically - however for some reason nothing in my 2nd child linear layout will appear when I load it. It just disappears for some strange reason.

XML

<LinearLayout 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:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <com.google.android.youtube.player.YouTubePlayerView
        android:id="@+id/youtubeplayerview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/titleTv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingBottom="7dip"
        android:paddingLeft="5dp"
        android:text=""
        android:textSize="20sp" />

    <LinearLayout
        android:id="@+id/videoInfo"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin" >

        <TextView
            android:id="@+id/uploaderTv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingBottom="5dip"
            android:paddingLeft="5dp"
            android:text=""
            android:textColor="@color/textlightgrey"
            android:textSize="16sp" />

        <TextView
            android:id="@+id/viewCountTv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingBottom="5dip"
            android:paddingLeft="6dip"
            android:text=""
            android:textSize="14sp" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/videoInfo"
        android:orientation="vertical"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin" >

        <TextView
            android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="left"
            android:text="TextView" />

        <TextView
            android:id="@+id/content"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/name"
            android:layout_weight="1"
            android:gravity="left"
            android:text="TextView" />

        <TextView
            android:id="@+id/published"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/content"
            android:layout_weight="1"
            android:gravity="left"
            android:text="TextView" />
    </LinearLayout>

</LinearLayout>
1

There are 1 answers

0
Vikram Singh On BEST ANSWER

You are using height as match_parent for both child linear layouts...use this one...

<com.google.android.youtube.player.YouTubePlayerView
    android:id="@+id/youtubeplayerview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<TextView
    android:id="@+id/titleTv"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingBottom="7dip"
    android:paddingLeft="5dp"
    android:text=""
    android:textSize="20sp" />

<LinearLayout
    android:id="@+id/videoInfo"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin" >

    <TextView
        android:id="@+id/uploaderTv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingBottom="5dip"
        android:paddingLeft="5dp"
        android:text=""
        android:textColor="@color/textlightgrey"
        android:textSize="16sp" />

    <TextView
        android:id="@+id/viewCountTv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingBottom="5dip"
        android:paddingLeft="6dip"
        android:text=""
        android:textSize="14sp" />
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/videoInfo"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin" >

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="left"
        android:text="TextView" />

    <TextView
        android:id="@+id/content"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/name"
        android:layout_weight="1"
        android:gravity="left"
        android:text="TextView" />

    <TextView
        android:id="@+id/published"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/content"
        android:layout_weight="1"
        android:gravity="left"
        android:text="TextView" />
</LinearLayout>