Reputation: 35
Update Question I like RecyclerView using Glide, because image will be load when item has appeared in the screen. Example : 100 item, 10 item has appeared in the screen, glide just load 10 item.
But when RecyclerView inside NestedScrollView, image will be load together (100 item load together). Question : how to use glide with RecyclerView inside NestedScrollView?
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedScroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.v4.widget.NestedScrollView>
Java Code
NestedScrollView nestedScroll = (NestedScrollView) findViewById(R.id.nestedScroll);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
LinearLayoutManager linear = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(linear);
recyclerView.setNestedScrollingEnabled(false);
Upvotes: -3
Views: 768
Reputation: 62419
Glide supports your wished behavior with the Priority enum and the .priority()
method.
The enum gives you four different options. This is the list ordered with increasing priority:
- Priority.LOW
- Priority.NORMAL
- Priority.HIGH
- Priority.IMMEDIATE
Usage Example:
Glide.with( context )
.load( "url" )
.priority( Priority.HIGH )
.into( imageViewHero );
Tryout it. Hope it will useful to you.
Source: https://futurestud.io/tutorials/glide-request-priorities
Upvotes: -1