0

Trying to build an Android app with a similar UI to the Google Play Store:

  • App Bar that hides with up scrolls and shows with down scrolls
  • Tab Bar that consistently stays visible and clickable
  • Multiple simple UI Elements like ImageViews & TextViews in each tab
  • Multiple different ListViews and GridViews in each tab

gps1 http://grailcloset.com/hosted/gps1.png gps2 http://grailcloset.com/hosted/gps2.png

The first three work fine, but putting any type of ListView (RecyclerView as well) inside the LinearLayout, inside of the NestedScrollView only shows the first list item as documented:

Android Listview show only one item

In short:

Activity:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/coordinatorLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways" />
        <android.support.design.widget.TabLayout
            android:id="@+id/tabLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabTextColor="@android:color/white"
            app:tabSelectedTextColor="@android:color/white"
            app:tabIndicatorColor="@android:color/white"
            app:tabIndicatorHeight="6dp"/>
    </android.support.design.widget.AppBarLayout>
    <android.support.v4.view.ViewPager
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

</android.support.design.widget.CoordinatorLayout>

Fragment:

<FrameLayout 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"
    tools:context="com.soletrade.grailsandroid.NewsFragment">

    <android.support.v4.widget.NestedScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="Large Text"
                android:id="@+id/textView" />

            <ListView
                android:id="@+id/list"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>


</FrameLayout>

doesn't work for showing multiple listviews and gridviews in a linearlayout.

Any help would be awesome, thanks!

Community
  • 1
  • 1
ogoldbart3
  • 273
  • 5
  • 14
  • Why do u need multiple listviews? The screenshot you have can be implemented with a single ListView and some buttons on the top. – pgiitu Oct 19 '15 at 23:54
  • Because in the project I need, it'd be great to be able to have a series of listviews and gridviews with different layouts in the same tab. It's doable with just loads of tables, but multiple listviews would make it easy. Also, in trying to do this with simply buttons on the top, it only shows one item from the listview. – ogoldbart3 Oct 20 '15 at 00:19

0 Answers0