<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.HomeFragment"
android:layout_marginBottom="60dp">
<TextView
android:id="#+id/cat_list_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Popular Categories"
android:gravity="center"
android:padding="10sp"
android:textSize="18sp"
android:fontFamily="#fonts/Montserrat-SemiBold.ttf"/>
<android.support.v7.widget.RecyclerView
android:layout_below="#id/cat_list_title"
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
<TextView
android:layout_below="#id/list"
android:id="#+id/stats_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/stats"
android:textSize="18sp"
android:gravity="center"
android:textColor="#color/black"
android:padding="10sp"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
How do I add the TextView after the RecyclerView in the NestedScrollView?
When I added it, it doesnt show up... However, the textView above the RecyclerView works and is visible
set android:nestedScrollingEnabled="false" in RecyclerView
replace
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.HomeFragment"
android:layout_marginBottom="60dp">
<TextView
android:id="#+id/cat_list_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Popular Categories"
android:gravity="center"
android:padding="10sp"
android:textSize="18sp"
android:fontFamily="#fonts/Montserrat-SemiBold.ttf"/>
<android.support.v7.widget.RecyclerView
android:layout_below="#id/cat_list_title"
android:id="#+id/list"
android:layout_width="match_parent"
android:nestedScrollingEnabled="false"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
<TextView
android:layout_below="#id/list"
android:id="#+id/stats_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/stats"
android:textSize="18sp"
android:gravity="center"
android:textColor="#color/black"
android:padding="10sp"/>
</RelativeLayout>
Try this code.. and change your needs according.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android" >
<android.support.v4.widget.NestedScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.HomeFragment"
android:layout_marginBottom="60dp">
<TextView
android:id="#+id/cat_list_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Popular Categories"
android:gravity="center"
android:padding="10sp"
android:textSize="18sp"
android:fontFamily="#fonts/Montserrat-SemiBold.ttf"/>
<android.support.v7.widget.RecyclerView
android:layout_below="#id/cat_list_title"
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
<TextView
android:layout_below="#id/list"
android:id="#+id/stats_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/stats"
android:textSize="18sp"
android:gravity="center"
android:textColor="#color/black"
android:padding="10sp"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="Hello World"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="40dp"
android:layout_marginRight="20dp"
/>
</RelativeLayout>
Related
in my layout i have recyclerview of product listing..below that im displaying total price in linearlayout ...but on scroll linearlayout is not displaying
sceneorio of my code:
1--> when i have one item on recyclerview -->linearlayout displays fine
2--> when i have more items on recyclerview -->on scrolling down linearlayout cant be seen(linear layout is not displaying)
need help in second sceneorio...thanks in advance
Following here is code xml:--
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/relative">
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:collapseIcon="#drawable/ic_arrow_back_black_24dp"
android:id="#+id/toolbartable"
android:background="#color/colorPrimaryDark">
</androidx.appcompat.widget.Toolbar>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/relative"
android:id="#+id/nest"
android:scrollbars="vertical">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_below="#id/relative"
android:layout_height="wrap_content"
android:id="#+id/recyleview"/>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:id="#+id/linearlayoutorder"
android:layout_below="#id/nest"
android:orientation="horizontal"
android:weightSum="2"
android:background="#drawable/border"
android:backgroundTintMode="#color/colorPrimary">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TOTAL"
android:layout_gravity="center"
android:layout_weight="1"></TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="#+id/totalidcost"
android:layout_gravity="right|center"
android:textAlignment="textEnd"
tools:ignore="RtlCompat"></TextView>
</LinearLayout>
</RelativeLayout>
Updated code:--
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/relative">
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:collapseIcon="#drawable/ic_arrow_back_black_24dp"
android:id="#+id/toolbartable"
android:background="#color/colorPrimaryDark">
</androidx.appcompat.widget.Toolbar>
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/nest"
android:scrollbars="vertical"
android:layout_below="#id/relative">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:id="#+id/recyleview"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:id="#+id/linearlayoutorder"
android:orientation="horizontal"
android:weightSum="2"
android:background="#drawable/border"
android:backgroundTintMode="#color/colorPrimary">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TOTAL"
android:layout_gravity="center"
android:layout_weight="1"></TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="#+id/totalidcost"
android:layout_gravity="right|center"
android:textAlignment="textEnd"
tools:ignore="RtlCompat"></TextView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
error getting--:Caused by: android.view.InflateException: Binary XML file line #34: ScrollView can host only one direct child
`Caused by: java.lang.IllegalStateException: ScrollView can host only one direct child`
need help
following solution worked for me:-
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/relative">
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:collapseIcon="#drawable/ic_arrow_back_black_24dp"
android:id="#+id/toolbartable"
android:background="#color/colorPrimaryDark">
</androidx.appcompat.widget.Toolbar>
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/nest"
android:scrollbars="vertical"
android:layout_below="#id/relative">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:id="#+id/recyleview"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:id="#+id/linearlayoutorder"
android:layout_below="#id/recyleview"
android:orientation="horizontal"
android:weightSum="2"
android:background="#drawable/border"
android:backgroundTintMode="#color/colorPrimary">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TOTAL"
android:layout_gravity="center"
android:layout_weight="1"></TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="#+id/totalidcost"
android:layout_gravity="right|center"
android:textAlignment="textEnd"
tools:ignore="RtlCompat"></TextView>
</LinearLayout>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
You haven't added weightSum and orientation values for LinearLayout.
Source
You can use a NestedScrollView instead of the ScrollView. And also put your RecyclerView as well as the LinearLayout inside the NestedScrollView. And enable android:nestedScrollingEnabled=true. Should work for you.
<NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled=true>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyleview"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#id/linearlayoutorder"
app:layout_constraintTop_toBottomOf="#id/relative" />
<LinearLayout
android:id="#+id/linearlayoutorder"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#000000"
android:backgroundTintMode="#color/colorPrimary"
android:orientation="horizontal"
android:weightSum="2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="TOTAL" />
<TextView
android:id="#+id/totalidcost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center"
android:layout_weight="1"
android:textAlignment="textEnd"
tools:ignore="RtlCompat" />
</LinearLayout>
</LinearLayout>
And in your java class where you have your recyclerview set recyclerView.setNestedScrollingEnabled(true or false);
Use ConstraintLayout like this way, Here is full xml code what you need
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/relative"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbartable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimaryDark"
app:collapseIcon="#drawable/back" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyleview"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#id/linearlayoutorder"
app:layout_constraintTop_toBottomOf="#id/relative" />
<LinearLayout
android:id="#+id/linearlayoutorder"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#000000"
android:backgroundTintMode="#color/colorPrimary"
android:orientation="horizontal"
android:weightSum="2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="TOTAL" />
<TextView
android:id="#+id/totalidcost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center"
android:layout_weight="1"
android:textAlignment="textEnd"
tools:ignore="RtlCompat" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
I am using NestedScrollView and I have 3 recyclerviews . I am parsing json and set data in recyclerview, now the issue is that in my last recyclerview I have set pagination feature, so until data is not fetched for that recyclerview, my whole screen got stuck and freeze. I tried a different solution for that. but it's not working and I found no change in result. can anyone help me with that?
XML
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#f0f0f0"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<include layout="#layout/reseller_home_title" />
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:id="#+id/bodyScroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:fillViewport="true"
android:background="#f0f0f0"
android:scrollbars="vertical">
<LinearLayout
android:id="#+id/llFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white">
<RelativeLayout
android:id="#+id/temp_orange_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorAccent"
/>
<com.youth.banner.Banner
android:id="#+id/banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginTop="#dimen/_10sdp"
app:indicator_drawable_selected="#drawable/library_module_bg_style_main_radious"
app:indicator_height="5dp"
app:indicator_width="5dp" />
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerViewCategoryData"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:isScrollContainer="false"
android:background="#color/white"
android:nestedScrollingEnabled="false"
android:paddingTop="#dimen/_10sdp" />
<LinearLayout
android:id="#+id/resellerPromotionBannerLayout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:weightSum="2"
android:orientation="horizontal"
android:background="#f0f0f0"
android:layout_marginTop="#dimen/_10sdp"
>
<ImageView
android:id="#+id/iv_top_left_pro"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<ImageView
android:id="#+id/iv_top_right_pro"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerViewGroupData"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
android:isScrollContainer="false"
android:nestedScrollingEnabled="false"
/>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerViewGroupProductData"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f0f0f0"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:descendantFocusability="blocksDescendants"
android:isScrollContainer="false"
android:nestedScrollingEnabled="false"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#f0f0f0"
android:layout_marginTop="#dimen/_5sdp"
>
<TextView
android:id="#+id/tv_size_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="THEY'RE ALL SELLING THIS"
android:layout_centerHorizontal="true"
android:textStyle="bold"
android:textColor="#color/colorBlack"
android:textSize="16dp" />
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerViewHpEntryData"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:isScrollContainer="false"
android:background="#f0f0f0"
android:layout_marginTop="#dimen/_5sdp"
android:nestedScrollingEnabled="false"
>
</android.support.v7.widget.RecyclerView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_15sdp"
android:background="#f0f0f0"
android:layout_marginTop="#dimen/_5sdp"
>
<ProgressBar
android:id="#+id/reseller_promotion_view_progress"
style="#style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="false"
android:max="100"
android:progress="20"
android:maxHeight="3dip"
android:minHeight="3dip"
android:progressDrawable="#drawable/resellerpromotion_progress" />
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerViewProductData"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#f0f0f0"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:descendantFocusability="blocksDescendants"
android:isScrollContainer="false"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_centerInParent="true" />
</RelativeLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
<ProgressBar
android:id="#+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<include layout="#layout/error_layout"
/>
</android.support.design.widget.CoordinatorLayout>
run below code for each of your RecyclerView within your NestedScrollView
ViewCompat.setNestedScrollingEnabled(recyclerView, false);
Try this code, it works well,
rvCompanies.setHasFixedSize(true);
LinearLayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
rvCompanies.setLayoutManager(layoutManager);
rvCompanies.setNestedScrollingEnabled(false); // important
I'm adding a BottomNavigationView to My MainActivity
at first show nothing wrong but after click on other items, BottomNavigationView strangely moving up and down. In other projects, I had never this problem and I don't know why I am getting this:
p.s: In default fragment (which is first at right in screenshot) I have a content but in other fragments, I have no content.
Here is my MainActivity layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.activity.MainActivity">
<FrameLayout
android:id="#+id/MainActivity_FrameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/MainActivity_BottomView" />
<android.support.design.widget.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/colorPrimary"
app:menu="#menu/main_bottom_view_menu"
app:elevation="2dp"
app:itemTextColor="#android:color/white"
app:itemIconTint="#android:color/white"
android:id="#+id/MainActivity_BottomView"/>
</RelativeLayout>
and here is the screenshot of how does shown
after clicking on another item
and when select default item again
--- EDIT ---
I realized it's happen when use CoordinatorLayout , AppBarLayout and CollapsingToolbarLayout in fragment . After remove that lines app work without any problem .
Here is my fragment Layout :
<android.support.design.widget.CoordinatorLayout 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:background="#e2e2e2"
android:animateLayoutChanges="true"
android:fitsSystemWindows="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.fragment.MainFragments.ProfileFragment">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:background="#color/colorPrimaryDark"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimaryDark"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:titleEnabled="false"
app:scrimAnimationDuration="300"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:background="#color/colorPrimaryDark"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="140dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:id="#+id/Profile_InfoContainer"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content">
<com.graymind.applog.customview.CircleImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="#+id/Profile_ProfilePhoto"
android:layout_marginTop="10dp"
android:scaleType="centerCrop"
app:srcCompat="#drawable/login_bg"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:textColor="#android:color/white"
android:gravity="center"
android:id="#+id/Profile_FullName"
android:text="FullName"
android:textStyle="bold"/>
<TextView
android:id="#+id/Profile_Id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="'#gray_mind75"
android:textColor="#android:color/white"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/Profile_Bio"
android:layout_width="match_parent"
android:layout_below="#+id/Profile_InfoContainer"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:layout_marginBottom="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textSize="12sp"
android:lineSpacingExtra="4sp"/>
android:textColor="#android:color/white"
android:textDirection="rtl" />
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:weightSum="3"
android:layout_below="#+id/Profile_Bio"
android:layout_height="50dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp"
android:weightSum="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:text="1234"
android:textColor="#android:color/white"
android:textSize="#dimen/profile_stats_texts_size"
android:gravity="center"
tools:ignore="NestedWeights" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:textSize="#dimen/profile_stats_texts_size"
android:textColor="#android:color/white"
android:gravity="center"
android:text="#string/post"/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/colorPrimary"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp"
android:weightSum="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:text="1234"
android:textSize="#dimen/profile_stats_texts_size"
android:textColor="#android:color/white"
android:gravity="center"
tools:ignore="NestedWeights" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:textColor="#android:color/white"
android:textSize="#dimen/profile_stats_texts_size"
android:gravity="center"
android:text="#string/followings"/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/colorPrimary"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp"
android:weightSum="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:text="1234"
android:textSize="#dimen/profile_stats_texts_size"
android:textColor="#android:color/white"
android:gravity="center"
tools:ignore="NestedWeights" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:textSize="#dimen/profile_stats_texts_size"
android:textColor="#android:color/white"
android:gravity="center"
android:text="#string/followers"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
app:layout_collapseMode="pin"
android:layout_height="?attr/actionBarSize">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="#string/profile"
android:gravity="center"
android:layout_toStartOf="#+id/Profile_ToolbarProfileIcon"
android:textColor="#android:color/white"
android:layout_marginEnd="10dp"/>
<ImageView
android:layout_width="30dp"
android:layout_marginEnd="10dp"
android:padding="5dp"
android:id="#+id/Profile_ToolbarProfileIcon"
android:layout_height="match_parent"
app:srcCompat="#drawable/ic_profile"
android:tint="#android:color/white"
android:layout_alignParentEnd="true"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:id="#+id/ProfilePostsScrollView"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:requiresFadingEdge="none"
android:id="#+id/Profile_PostsRecycler"/>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Thanks in advance for your guidance.
Change your root layout to LinearLayout like below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.activity.MainActivity">
<FrameLayout
android:id="#+id/MainActivity_FrameLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<android.support.design.widget.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
app:menu="#menu/main_bottom_view_menu"
app:elevation="2dp"
app:itemTextColor="#android:color/white"
app:itemIconTint="#android:color/white"
android:id="#+id/MainActivity_BottomView" />
</LinearLayout>
I tried to make a scrollable view with one ViewPager which will take 90% of the screen and then some useful information about images inside the ViewPager.
However, when I add the ScrollView widget, all sizes and weight doesn't work even if I set android:fillViewport="true". Here's my layout.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="100"
android:scrollbars="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/background_light"
android:elevation="0dp"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:popupTheme="?android:attr/homeAsUpIndicator" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="90"
android:orientation="vertical"
android:padding="50dip">
<android.support.v4.view.ViewPager
android:id="#+id/product_sheet_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
<TextView
android:id="#+id/product_sheet_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="bbb"/>
<TextView
android:id="#+id/product_sheet_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Color: Yellow" />
<TextView
android:id="#+id/product_sheet_reference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Ref: 2049/889/300" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
Remove the android:fillViewport="true" and set the layout_height of your NestedScrollView to match_parent.
So here's the final layout should look like.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:scrollbars="vertical"
android:weightSum="100">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/background_light"
android:elevation="0dp"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:popupTheme="?android:attr/homeAsUpIndicator" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="90"
android:orientation="vertical"
android:padding="50dip">
<android.support.v4.view.ViewPager
android:id="#+id/product_sheet_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<TextView
android:id="#+id/product_sheet_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="bbb" />
<TextView
android:id="#+id/product_sheet_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Color: Yellow" />
<TextView
android:id="#+id/product_sheet_reference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Ref: 2049/889/300" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<?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"
>
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:layout_above="#+id/relativeLayoutBottom"
>
<android.support.v4.view.ViewPager
android:id="#+id/viewPagerPlanDetailBroucher"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="250dp"
android:numColumns="auto_fit"
android:verticalSpacing="1dp"
android:horizontalSpacing="1dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="50dp"
>
</android.support.v4.view.ViewPager>
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayoutBottom"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:paddingTop="5dp"
>
<TextView
android:id="#+id/product_sheet_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="bbb"/>
<TextView
android:id="#+id/product_sheet_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#+id/product_sheet_description"
android:text="Color: Yellow" />
<TextView
android:id="#+id/product_sheet_reference"
android:layout_below="#+id/product_sheet_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Ref: 2049/889/300" />
</RelativeLayout>
</RelativeLayout>
This is my payout file.
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.wokoshop.sony.activity.ActivityShoppingCart">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_alignParentTop="true"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:layout_below="#+id/toolbar"
android:layout_above="#+id/card_view"
/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/card_view"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
>
<CheckBox
android:id="#+id/applyWallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Apply wallet"
android:checked="true"
android:layout_above="#+id/mainText"
/>
<TextView
android:id="#+id/mainText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textColor="#color/primary_dark"
android:layout_centerHorizontal="true"
android:layout_above="#+id/placeOrderButton"
/>
<Button
android:id="#+id/placeOrderButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="PLACE ORDER"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
It is displaying bottom card view items and toolbar. But not displaying recyclerView Items. items are available in recyclerView, But i am missing something in layout file (display part)
Can anyone help me what i am missing here?
You have not set layout_below property in cardview. That is why your recyclerview is overlapped by cardview
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.wokoshop.sony.activity.ActivityShoppingCart">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_alignParentTop="true"/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/card_view"
android:alignParentBottom="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
>
<CheckBox
android:id="#+id/applyWallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Apply wallet"
android:checked="true"
android:layout_above="#+id/mainText"
/>
<TextView
android:id="#+id/mainText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textColor="#color/primary_dark"
android:layout_centerHorizontal="true"
android:layout_above="#+id/placeOrderButton"
/>
<Button
android:id="#+id/placeOrderButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="PLACE ORDER"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:layout_below="#+id/toolbar"
android:layout_above="#+id/card_view"
/>
</RelativeLayout>
Try this..
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.wokoshop.sony.activity.ActivityShoppingCart">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_alignParentTop="true"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:layout_below="#+id/toolbar"
android:layout_above="#+id/card_view"
/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/card_view"
android:layout_alignParentBottom="true"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
>
<CheckBox
android:id="#+id/applyWallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Apply wallet"
android:checked="true"
android:layout_above="#+id/mainText"
/>
<TextView
android:id="#+id/mainText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textColor="#color/primary_dark"
android:layout_centerHorizontal="true"
android:layout_above="#+id/placeOrderButton"
/>
<Button
android:id="#+id/placeOrderButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="PLACE ORDER"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
try this i think it will solve your problem.....
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.wokoshop.sony.activity.ActivityShoppingCart">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_alignParentTop="true"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:layout_below="#+id/toolbar"
/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/card_view"
android:layout_below="#+id/recycler_view"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
>
<CheckBox
android:id="#+id/applyWallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Apply wallet"
android:checked="true"
android:layout_above="#+id/mainText"
/>
<TextView
android:id="#+id/mainText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textColor="#color/primary_dark"
android:layout_centerHorizontal="true"
android:layout_above="#+id/placeOrderButton"
/>
<Button
android:id="#+id/placeOrderButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="PLACE ORDER"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>