NestedScrollView getting stuck with recyclerview - android

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

Related

The view is not a child of CoordinatorLayout

I am getting java.lang.RuntimeException: Unable to start activity java.lang.IllegalArgumentException: The view is not a child of CoordinatorLayout.working with bottom sheet, I have tried lot of combination but still i am not getting solution. please tell me any solution.Thank you in advance.
<?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:id="#+id/beyprod"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/toolbarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
</LinearLayout>
<!-- <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="#+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/bottom_sheet_behavior" />
</LinearLayout>-->
<android.support.v4.widget.NestedScrollView
android:id="#+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="#string/bottom_sheet_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".retailerModule.cart.activity.AddressListActivity">
<ProgressBar
android:id="#+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relaLaySearch"
android:layout_gravity="center|top"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/confirmBtn"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
<TextView
android:id="#+id/addNewAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="right"
android:layout_marginTop="15dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="40dp"
android:background="#color/green"
android:gravity="center"
android:padding="10dp"
android:text="New Address"
android:textColor="#color/colorWhite" />
</LinearLayout>
<android.support.v7.widget.AppCompatButton
android:id="#+id/continueBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="right"
android:background="#color/color_blue"
android:gravity="center"
android:text="SAVE"
android:textColor="#color/colorWhite"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
When i tried to run this line getting exception
NestedScrollView mBehavior = BottomSheetBehavior.from(bottom_sheet);
It tells you that you can only put a BottomSheetBehavior into a CoordinatorLayout.
So make CoordinatorLayout as your root layout and place it directly here (not in some nested views)

RecyclerView scrolling very slow with NestedScrollView

I have a RecyclerView with a NestedScrollView and the recycler view scrolling is very very slow. Why is this happening, and how can I fix this?
After googleing and searching in Stack Overflow, i got this solution:
mMyRecyclerView.setNestedScrollingEnabled(false);
But it does not improve the scroll speed in my case, please help.
This is my xml code
<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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="fragment.HomeFrg">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<!-- TODO: Update blank fragment layout -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/ns1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="#+id/card_background_new_design"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:cardElevation="5dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:id="#+id/bestdeal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:padding="5dp"
android:paddingEnd="10dp"
android:paddingStart="10dp"
android:text="DEALS"
android:visibility="gone"
android:textColor="#color/colorPrimary"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="#+id/viewall"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="end"
android:padding="5dp"
android:text="View All"
android:textColor="#color/colorPrimary"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view_page2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="10dp"
android:clipToPadding="false"
android:layout_marginBottom="5dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="#+id/activity_main_webview"
android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="150dp" />
<TextView
android:id="#+id/homefrgMsg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/nonetwork"
android:textSize="30sp"
android:visibility="visible"
android:textStyle="normal|bold" />
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="42dp"
android:layout_gravity="center"
android:layout_height="42dp"
android:visibility="visible"
android:id="#+id/progressBar_home_frg" />
</FrameLayout>
</FrameLayout>
This is my app on google play store, for your reference.
try to use this when you call your Linear layout manager
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false){
#Override
public boolean canScrollVertically() {
return false;
}
});
I am not sure but try RecyclerView height match_parent to wrap_content

Unable to add views after RecyclerView in NestedScrollView

<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>

How to make two cardview scrolling horizontally?

I have two cardview which have different childview and i want them to display at the bottom of my screen and want them horizontally scrolling, i have read other docs. but none of them fits for me. i have tried Horizontalscrollview but it didn't help.
Thanks in advance.
<android.support.v7.widget.CardView
android:id="#+id/cardViewDemo1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:layout_weight="1"
android:elevation="5dp"
app:cardBackgroundColor="#e4a455"
app:cardCornerRadius="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp"
android:weightSum="1">
<FrameLayout
android:id="#+id/frameDemoOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".2">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="3dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:scaleType="fitXY"
android:src="#drawable/demo_one" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/frame" />
</FrameLayout>
<android.support.v7.widget.CardView
android:id="#+id/cardViewDemo3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:layout_weight=".8"
app:cardBackgroundColor="#e9e6e3"
app:cardCornerRadius="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="DEMOVIDEOONE"
android:textColor="#c9750f"
android:textSize="15sp"
android:textStyle="bold" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/cardViewDemo2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:layout_weight="1"
android:elevation="5dp"
app:cardBackgroundColor="#e4a455"
app:cardCornerRadius="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp"
android:weightSum="1">
<FrameLayout
android:layout_weight=".2"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:padding="5dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="#drawable/demo_one" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/frame" />
</FrameLayout>
<android.support.v7.widget.CardView
app:cardBackgroundColor="#e1b784"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:layout_weight=".8"
app:cardCornerRadius="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="DEMOVIDEOONE"
android:textColor="#fff"
android:textSize="15sp"
android:textStyle="bold" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v7.widget.CardView>
Use NestedScrollView as a container of two CardView.
Here is an example:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.CardView
android:id="#+id/card_view_one"
android:layout_width="300dp"
android:layout_height="200dp">
<!-- Content -->
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/card_view_two"
android:layout_width="300dp"
android:layout_height="200dp">
<!-- Content -->
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>

How to use swipe refresh with recyclerivew

I have use swipe resfresh with recyclerivew. but I see one problem. I can't scroll my recyclerivew up. I can scroll recyclerview down normally but every time I try to scroll up it will not scroll it up it is work the function swift refresh how ever I am not scrol up to the top yet.
Here is my xml
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginBottom="-5dp"
android:id="#+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/buslayout"
android:focusableInTouchMode="true"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:layout_gravity="center"
android:gravity="center"
android:text="Loading..."
android:id="#+id/info"
android:visibility="visible"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/business_recycle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>
Try this:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginBottom="-5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:layout_gravity="center"
android:gravity="center"
android:text="Loading..."
android:id="#+id/info"
android:visibility="visible"/>
<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/swiperefresh"
android:focusableInTouchMode="true"
>
<android.support.v7.widget.RecyclerView
android:id="#+id/business_recycle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>

Categories

Resources