如何在 android 小部件中设置 RecyclerView [英] How to set RecyclerView in android widget

查看:28
本文介绍了如何在 android 小部件中设置 RecyclerView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自:https://developer.android.com/training/material/列表卡片.html

我想在主屏幕的小部件中设置 RecyclerView.有可能吗,如果可以,该怎么做?请给一些样品.

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.

推荐答案

不支持RecyclerView 用作RemoteView.请参阅 CreatingLayout

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

RemoteViews 对象(以及相应的 App Widget)可以支持以下布局类:

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

框架布局
线性布局
相对布局
网格布局

FrameLayout
LinearLayout
RelativeLayout
GridLayout

以及以下小部件类:
模拟时钟
按钮天文台表
图像按钮
图像视图
进度条
文本视图
ViewFlipper
列表视图
网格视图
堆栈视图
AdapterViewFlipper

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

这篇关于如何在 android 小部件中设置 RecyclerView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆