0

I have a RelativeLayout within a LinearLayout however none of the items it contains appear on screen. For some reason only the VidesListView and the Button appear and nothing else.

I'm pretty sure I've implemented my ViewPager correctly in Java - but I included it's source just in case.

Please let me know if any additional information is required.

enter image description here

XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:onClick="getUserYouTubeFeed"
        android:text="Get YouTube Feed for &apos;blundellp&apos;" />

    <com.blundell.tut.ui.widget.VideosListView
        android:id="@+id/videosListView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

    <RelativeLayout
        android:id="@+id/footer"
        android:layout_width="fill_parent"
        android:layout_height="70dip"
        android:layout_alignParentBottom="true" >

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:src="@drawable/home_up_btn" />

        <HorizontalScrollView
            android:id="@+id/groupScrollView"
            android:layout_width="fill_parent"
            android:layout_height="match_parent" >

            <ImageView
                android:id="@+id/selstation_up_btn"
                android:layout_width="fill_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center_horizontal"
                android:scaleType="fitXY"
                android:src="@drawable/selstation_up_btn" />
        </HorizontalScrollView>

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:src="@drawable/scroll_lt_arrow" />

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:src="@drawable/scroll_rt_arrow" />

        <android.support.v4.view.ViewPager
            android:id="@+id/view_pager"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </RelativeLayout>

</LinearLayout>

SOURCE:

http://blog.blundell-apps.com/show-youtube-user-videos-in-a-listview/

user3009687
  • 369
  • 2
  • 7
  • 17
  • The issue you are having is because the video list view is growing infintely, nothing below it will be visible. You have to limit it somehow. One possible approach would be to use a relative layout for the outer most layer that would allow you to bound constraints on each section of the screen. – blindstuff Dec 03 '13 at 18:30
  • Bingo! (if you'd like you can post this as an answer!) – user3009687 Dec 03 '13 at 19:03
  • Added the answer. Glad it worked. – blindstuff Dec 03 '13 at 19:49

3 Answers3

0

ViewPager does not work with a height of wrap_content because it doesn't have all of its children loaded normally. Setting height to match_parent works as well as a constant value (i.e. 150dp).

James McCracken
  • 15,488
  • 5
  • 54
  • 62
  • I just noticed I can't see anything below my VideosListView - I'm going to post a screenshot and an updated description – user3009687 Dec 03 '13 at 18:23
0

You have problem in XML. alignParentBottom property doesnot apply within LinearLayout. You have it on RelativeLayout like this.

<RelativeLayout
    android:id="@+id/footer"
    android:layout_width="fill_parent"
    android:layout_height="70dip"
    android:layout_alignParentBottom="true" >

Remove alignParentBottom and it will show it.

<RelativeLayout
    android:id="@+id/footer"
    android:layout_width="fill_parent"
    android:layout_height="70dip"
  >
amrinder007
  • 1,455
  • 1
  • 12
  • 13
0

The issue you are having is because the video list view is growing infintely, nothing below it will be visible. You have to limit it somehow. One possible approach would be to use a relative layout for the outer most layer that would allow you to bound constraints on each section of the screen

blindstuff
  • 18,298
  • 10
  • 47
  • 48
  • I appreciate your help! If you'd like 2 more easy answers... I have two more easy questions! : ) http://stackoverflow.com/questions/20338602/increasing-a-youtube-thumbnail-size http://stackoverflow.com/questions/20359832/viewpager-is-not-visible-in-xml-layout – user3009687 Dec 03 '13 at 19:53