1 of the RecyclerView inside NestedScrollView doesn't load at the start of the activity





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have three recycler View inside the Nested Scroll View when the activity is started it doesn't load first recycler View. I have swipe Refresh Layout in app when I refresh all the recycler View are loaded properly. The second recycler view doesn't load at the start of the activity tried every solution.



Java File



shops.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot photosnapshot:dataSnapshot.getChildren())
{
Shops temp=photosnapshot.getValue(Shops.class);
Location templocation=new Location(LocationManager.GPS_PROVIDER);
Location templocation1=new Location(LocationManager.GPS_PROVIDER);
templocation.setLatitude(temp.getAddress().getLatitude());
templocation.setLongitude(temp.getAddress().getLongitude());
templocation1.setLatitude(common.currentLocation.getLatitude());
templocation1.setLongitude(common.currentLocation.getLongitude());
if(templocation.distanceTo(templocation1)<1500)
{
shopslist.add(new Shops(temp.getName(),temp.getImage(),temp.getStatus(),temp.getTimings(),temp.getAddress(),photosnapshot.getKey(),temp.getCategory()));
if(temp.getCategory().equals("02"))
{
dairyshoplist.add(new Shops(temp.getName(),temp.getImage(),temp.getStatus(),temp.getTimings(),temp.getAddress(),photosnapshot.getKey(),temp.getCategory()));
}



}
}
menuAdapter.notifyDataSetChanged();



recyclemenu= (RecyclerView) findViewById(R.id.recycler_menu);
recyclecategory=findViewById(R.id.recycler_menu_categories);
headerusername= (TextView) headerview.findViewById(R.id.textnameheader);
headerusername.setText(common.currentuser.getName());
recyclemenu.setHasFixedSize(true);
recyclecategory.setHasFixedSize(true);
layoutManager= new LinearLayoutManager(this);
layoutManager.setAutoMeasureEnabled(true);
recyclemenu.setLayoutManager(layoutManager);
recyclecategory.setLayoutManager(new GridLayoutManager(this,2));
recycle_dairy_shops.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true));
recycle_dairy_shops.setHasFixedSize(true);
recyclemenu.setNestedScrollingEnabled(false);
recycle_dairy_shops.setNestedScrollingEnabled(false);
recyclecategory.setNestedScrollingEnabled(false);


.xml File



<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/swipeLayout"
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"
tools:context="com.example.mahesh.door_step.Home"
tools:showIn="@layout/app_bar_home"
>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"

>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
>

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_menu_categories"
android:fillViewport="true"
android:layout_below="@+id/search"
android:layout_marginTop="10dp"
android:scrollbars="vertical"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_menu"
android:fillViewport="true"

android:layout_marginTop="10dp"
android:layout_below="@+id/recycler_menu_categories"
android:scrollbars="vertical"/>

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_menu_dairyshops"
android:fillViewport="true"
android:layout_marginTop="10dp"
android:layout_below="@+id/nearbyshopid"
android:scrollbars="vertical"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>









share|improve this question























  • scrollview has weird behavior when you use layout_height="match_parent" . Try to change the layout_height from NestedScrollView to wrap_content

    – Alberto Crespo
    Nov 23 '18 at 15:13











  • I don't see any line where you put data in recyclerview?

    – Benjamin
    Nov 23 '18 at 15:13


















0















I have three recycler View inside the Nested Scroll View when the activity is started it doesn't load first recycler View. I have swipe Refresh Layout in app when I refresh all the recycler View are loaded properly. The second recycler view doesn't load at the start of the activity tried every solution.



Java File



shops.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot photosnapshot:dataSnapshot.getChildren())
{
Shops temp=photosnapshot.getValue(Shops.class);
Location templocation=new Location(LocationManager.GPS_PROVIDER);
Location templocation1=new Location(LocationManager.GPS_PROVIDER);
templocation.setLatitude(temp.getAddress().getLatitude());
templocation.setLongitude(temp.getAddress().getLongitude());
templocation1.setLatitude(common.currentLocation.getLatitude());
templocation1.setLongitude(common.currentLocation.getLongitude());
if(templocation.distanceTo(templocation1)<1500)
{
shopslist.add(new Shops(temp.getName(),temp.getImage(),temp.getStatus(),temp.getTimings(),temp.getAddress(),photosnapshot.getKey(),temp.getCategory()));
if(temp.getCategory().equals("02"))
{
dairyshoplist.add(new Shops(temp.getName(),temp.getImage(),temp.getStatus(),temp.getTimings(),temp.getAddress(),photosnapshot.getKey(),temp.getCategory()));
}



}
}
menuAdapter.notifyDataSetChanged();



recyclemenu= (RecyclerView) findViewById(R.id.recycler_menu);
recyclecategory=findViewById(R.id.recycler_menu_categories);
headerusername= (TextView) headerview.findViewById(R.id.textnameheader);
headerusername.setText(common.currentuser.getName());
recyclemenu.setHasFixedSize(true);
recyclecategory.setHasFixedSize(true);
layoutManager= new LinearLayoutManager(this);
layoutManager.setAutoMeasureEnabled(true);
recyclemenu.setLayoutManager(layoutManager);
recyclecategory.setLayoutManager(new GridLayoutManager(this,2));
recycle_dairy_shops.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true));
recycle_dairy_shops.setHasFixedSize(true);
recyclemenu.setNestedScrollingEnabled(false);
recycle_dairy_shops.setNestedScrollingEnabled(false);
recyclecategory.setNestedScrollingEnabled(false);


.xml File



<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/swipeLayout"
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"
tools:context="com.example.mahesh.door_step.Home"
tools:showIn="@layout/app_bar_home"
>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"

>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
>

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_menu_categories"
android:fillViewport="true"
android:layout_below="@+id/search"
android:layout_marginTop="10dp"
android:scrollbars="vertical"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_menu"
android:fillViewport="true"

android:layout_marginTop="10dp"
android:layout_below="@+id/recycler_menu_categories"
android:scrollbars="vertical"/>

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_menu_dairyshops"
android:fillViewport="true"
android:layout_marginTop="10dp"
android:layout_below="@+id/nearbyshopid"
android:scrollbars="vertical"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>









share|improve this question























  • scrollview has weird behavior when you use layout_height="match_parent" . Try to change the layout_height from NestedScrollView to wrap_content

    – Alberto Crespo
    Nov 23 '18 at 15:13











  • I don't see any line where you put data in recyclerview?

    – Benjamin
    Nov 23 '18 at 15:13














0












0








0








I have three recycler View inside the Nested Scroll View when the activity is started it doesn't load first recycler View. I have swipe Refresh Layout in app when I refresh all the recycler View are loaded properly. The second recycler view doesn't load at the start of the activity tried every solution.



Java File



shops.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot photosnapshot:dataSnapshot.getChildren())
{
Shops temp=photosnapshot.getValue(Shops.class);
Location templocation=new Location(LocationManager.GPS_PROVIDER);
Location templocation1=new Location(LocationManager.GPS_PROVIDER);
templocation.setLatitude(temp.getAddress().getLatitude());
templocation.setLongitude(temp.getAddress().getLongitude());
templocation1.setLatitude(common.currentLocation.getLatitude());
templocation1.setLongitude(common.currentLocation.getLongitude());
if(templocation.distanceTo(templocation1)<1500)
{
shopslist.add(new Shops(temp.getName(),temp.getImage(),temp.getStatus(),temp.getTimings(),temp.getAddress(),photosnapshot.getKey(),temp.getCategory()));
if(temp.getCategory().equals("02"))
{
dairyshoplist.add(new Shops(temp.getName(),temp.getImage(),temp.getStatus(),temp.getTimings(),temp.getAddress(),photosnapshot.getKey(),temp.getCategory()));
}



}
}
menuAdapter.notifyDataSetChanged();



recyclemenu= (RecyclerView) findViewById(R.id.recycler_menu);
recyclecategory=findViewById(R.id.recycler_menu_categories);
headerusername= (TextView) headerview.findViewById(R.id.textnameheader);
headerusername.setText(common.currentuser.getName());
recyclemenu.setHasFixedSize(true);
recyclecategory.setHasFixedSize(true);
layoutManager= new LinearLayoutManager(this);
layoutManager.setAutoMeasureEnabled(true);
recyclemenu.setLayoutManager(layoutManager);
recyclecategory.setLayoutManager(new GridLayoutManager(this,2));
recycle_dairy_shops.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true));
recycle_dairy_shops.setHasFixedSize(true);
recyclemenu.setNestedScrollingEnabled(false);
recycle_dairy_shops.setNestedScrollingEnabled(false);
recyclecategory.setNestedScrollingEnabled(false);


.xml File



<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/swipeLayout"
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"
tools:context="com.example.mahesh.door_step.Home"
tools:showIn="@layout/app_bar_home"
>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"

>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
>

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_menu_categories"
android:fillViewport="true"
android:layout_below="@+id/search"
android:layout_marginTop="10dp"
android:scrollbars="vertical"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_menu"
android:fillViewport="true"

android:layout_marginTop="10dp"
android:layout_below="@+id/recycler_menu_categories"
android:scrollbars="vertical"/>

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_menu_dairyshops"
android:fillViewport="true"
android:layout_marginTop="10dp"
android:layout_below="@+id/nearbyshopid"
android:scrollbars="vertical"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>









share|improve this question














I have three recycler View inside the Nested Scroll View when the activity is started it doesn't load first recycler View. I have swipe Refresh Layout in app when I refresh all the recycler View are loaded properly. The second recycler view doesn't load at the start of the activity tried every solution.



Java File



shops.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot photosnapshot:dataSnapshot.getChildren())
{
Shops temp=photosnapshot.getValue(Shops.class);
Location templocation=new Location(LocationManager.GPS_PROVIDER);
Location templocation1=new Location(LocationManager.GPS_PROVIDER);
templocation.setLatitude(temp.getAddress().getLatitude());
templocation.setLongitude(temp.getAddress().getLongitude());
templocation1.setLatitude(common.currentLocation.getLatitude());
templocation1.setLongitude(common.currentLocation.getLongitude());
if(templocation.distanceTo(templocation1)<1500)
{
shopslist.add(new Shops(temp.getName(),temp.getImage(),temp.getStatus(),temp.getTimings(),temp.getAddress(),photosnapshot.getKey(),temp.getCategory()));
if(temp.getCategory().equals("02"))
{
dairyshoplist.add(new Shops(temp.getName(),temp.getImage(),temp.getStatus(),temp.getTimings(),temp.getAddress(),photosnapshot.getKey(),temp.getCategory()));
}



}
}
menuAdapter.notifyDataSetChanged();



recyclemenu= (RecyclerView) findViewById(R.id.recycler_menu);
recyclecategory=findViewById(R.id.recycler_menu_categories);
headerusername= (TextView) headerview.findViewById(R.id.textnameheader);
headerusername.setText(common.currentuser.getName());
recyclemenu.setHasFixedSize(true);
recyclecategory.setHasFixedSize(true);
layoutManager= new LinearLayoutManager(this);
layoutManager.setAutoMeasureEnabled(true);
recyclemenu.setLayoutManager(layoutManager);
recyclecategory.setLayoutManager(new GridLayoutManager(this,2));
recycle_dairy_shops.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true));
recycle_dairy_shops.setHasFixedSize(true);
recyclemenu.setNestedScrollingEnabled(false);
recycle_dairy_shops.setNestedScrollingEnabled(false);
recyclecategory.setNestedScrollingEnabled(false);


.xml File



<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/swipeLayout"
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"
tools:context="com.example.mahesh.door_step.Home"
tools:showIn="@layout/app_bar_home"
>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"

>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
>

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_menu_categories"
android:fillViewport="true"
android:layout_below="@+id/search"
android:layout_marginTop="10dp"
android:scrollbars="vertical"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_menu"
android:fillViewport="true"

android:layout_marginTop="10dp"
android:layout_below="@+id/recycler_menu_categories"
android:scrollbars="vertical"/>

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler_menu_dairyshops"
android:fillViewport="true"
android:layout_marginTop="10dp"
android:layout_below="@+id/nearbyshopid"
android:scrollbars="vertical"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>






android firebase






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 15:09









MaheshMahesh

35




35













  • scrollview has weird behavior when you use layout_height="match_parent" . Try to change the layout_height from NestedScrollView to wrap_content

    – Alberto Crespo
    Nov 23 '18 at 15:13











  • I don't see any line where you put data in recyclerview?

    – Benjamin
    Nov 23 '18 at 15:13



















  • scrollview has weird behavior when you use layout_height="match_parent" . Try to change the layout_height from NestedScrollView to wrap_content

    – Alberto Crespo
    Nov 23 '18 at 15:13











  • I don't see any line where you put data in recyclerview?

    – Benjamin
    Nov 23 '18 at 15:13

















scrollview has weird behavior when you use layout_height="match_parent" . Try to change the layout_height from NestedScrollView to wrap_content

– Alberto Crespo
Nov 23 '18 at 15:13





scrollview has weird behavior when you use layout_height="match_parent" . Try to change the layout_height from NestedScrollView to wrap_content

– Alberto Crespo
Nov 23 '18 at 15:13













I don't see any line where you put data in recyclerview?

– Benjamin
Nov 23 '18 at 15:13





I don't see any line where you put data in recyclerview?

– Benjamin
Nov 23 '18 at 15:13












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449052%2f1-of-the-recyclerview-inside-nestedscrollview-doesnt-load-at-the-start-of-the-a%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449052%2f1-of-the-recyclerview-inside-nestedscrollview-doesnt-load-at-the-start-of-the-a%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()