0

I have viewpager at the top to slide and view images . and after a list to see remaining images or whatever i want to display in list and after that i have a RelativeLayout below this list which i will populate with the Code

Now Issue is :- I am facing a problem with RecycleView . It was working fine until i add a RelativeLayout to parentofbottom and setting RecycleView property to above this RelativeLayout . Now Issue is RecycleView is not scrolling at all . whats wrong with the code. What needs to be change .Or Suggest me anyother way to achieve this design

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <RelativeLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:focusableInTouchMode="true"
        android:layout_height="match_parent" >

        <RelativeLayout
            android:id="@+id/relativeHeader"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:background="@color/headecolor" >

            <Button
                android:id="@+id/btnOpenDrawer"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                android:background="@drawable/menu_icon" />

            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:background="@drawable/alert_icon" />

            <TextView
                android:id="@+id/txtTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:textStyle="bold"
                android:text="A La Une"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/blackColor" />
        </RelativeLayout>

        <android.support.v4.widget.NestedScrollView
        android:id="@+id/scroler"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/relativeHeader"
        android:fillViewport="true"
        android:background="@android:color/white" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:focusableInTouchMode="true"
            android:background="@android:color/white" >

            <RelativeLayout
                android:id="@+id/relativeLayout1"
                android:layout_width="wrap_content"
                android:descendantFocusability="blocksDescendants"
                android:layout_height="wrap_content" >

                <RelativeLayout
                    android:id="@+id/rlPager"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <egdigital.alpes1.view.WrapContentViewPager
                        android:id="@+id/view_pager"
                        android:layout_width="match_parent"
                        android:layout_height="220dp"
                        android:adjustViewBounds="true"
                        android:background="@drawable/news_img_transparent"
                        />

                    <ImageView
                        android:id="@+id/imageView_dot"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignBottom="@+id/view_pager"
                        android:layout_alignParentLeft="true"
                        android:src="@drawable/scroll_dot1" />

                </RelativeLayout>

            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/rlRecycle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/relativeLayout1"
                android:layout_above="@+id/rlMiniPlayer"
                >

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerview"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipToPadding="false"
                android:paddingBottom="80dp">
            </android.support.v7.widget.RecyclerView>
                </RelativeLayout>
            <RelativeLayout
                android:id="@+id/rlMiniPlayer"
                android:layout_width="match_parent"
                android:layout_height="80dp"
                android:layout_alignParentBottom="true"
                >
            </RelativeLayout>

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

    <fragment
        android:id="@+id/navigation_drawer"
        android:name=".NavigationDrawerFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:layout_marginLeft="25dp"
        tools:layout="@layout/fragment_navigation_drawer" />

</android.support.v4.widget.DrawerLayout>
Ali Abhas
  • 107
  • 7

2 Answers2

0

1) Change

android:layout_below="@+id/relativeLayout1" to android:layout_below="@id/relativeLayout1" and change anywhere else you have layout_below or layout_above

+ is used when creating a new id. When giving an already created id we use it without +

2) You don't really need RelativeLayout with id rlRecycle. You can directly move layout_below and layout_above attributes to RecyclerView because it's already under top level RelativeLayout

Sharjeel
  • 15,588
  • 14
  • 58
  • 89
  • Thanks for The Explanations . know i am facing the issue in adapter if i use something like if (list.size()==20){ txt.setVisibility(View.Visible)} . Recycleview adds lots of extra space after that .. i dont whats going wrong in that .. i am manually calculating the recycleview item height . @sharj – Ali Abhas Jul 22 '16 at 11:06
0

I Found The Solution . i know there are lots of extra RelativeLayouts . Know I removed it . and putted rlMiniPlayer below the nested scrollview Because I am using nestedscrolling=true . in the code . This is creating the problem

Like This :-

</android.support.v4.widget.NestedScrollView>
        <RelativeLayout
            android:id="@+id/rlMiniPlayer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            >
        </RelativeLayout>
Ali Abhas
  • 107
  • 7