Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set RecyclerView in android widget

From : https://developer.android.com/training/material/lists-cards.html

I want to set RecyclerView in widget on home screen. Is it possible, and if it is, how to do it? Give some samples please.

like image 793
Stopfan Avatar asked Nov 14 '14 21:11

Stopfan


People also ask

What is widget RecyclerView?

This widget is a container for displaying large data sets that can be scrolled very efficiently by maintaining a limited number of views. Use the RecyclerView widget when you have data collections whose elements change at runtime based on user action or network events.

What is RecyclerView in Android with example?

RecyclerView is the ViewGroup that contains the views corresponding to your data. It's a view itself, so you add RecyclerView into your layout the way you would add any other UI element. Each individual element in the list is defined by a view holder object.

What is RecyclerView adapter in android?

The RecyclerView class extends the ViewGroup class and implements ScrollingView interface. It is introduced in Marshmallow. It is an advanced version of the ListView with improved performance and other benefits.


2 Answers

RecyclerView is not supported to be used as a RemoteView. See CreatingLayout

A RemoteViews object (and, consequently, an App Widget) can support the following layout classes:

FrameLayout
LinearLayout
RelativeLayout
GridLayout

And the following widget classes:
AnalogClock
Button Chronometer
ImageButton
ImageView
ProgressBar
TextView
ViewFlipper
ListView
GridView
StackView
AdapterViewFlipper

like image 190
Jared Rummler Avatar answered Oct 06 '22 12:10

Jared Rummler


RecyclerView is not presently supported for app widgets.

like image 21
CommonsWare Avatar answered Oct 06 '22 11:10

CommonsWare