如何使用 ExpandableListView 创建小部件?
我想创建小部件,它将显示一些分类信息。我想到在我的小部件中使用 ExpandableListView。有可能吗?如果是 - 如何做到这一点?
I want to create widget which will show some information divided into categories. I came with idea to use ExpandableListView in my widget. Is is possible? If yes - how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是可能的。您需要扩展 BaseExpandableListViewAdapter 并实现其中的方法。您还需要为您想要显示的内容创建布局 xml 文件,并将其指定给适配器,或者如果您有多个适配器,则自行扩展它。
一个很好的例子是 http:// /developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.html 这是可扩展列表是整个活动的地方屏幕,但如果你像我在单独的文件中所说的那样扩展它,并在你的活动中包含一个 ExpandableListView ,它也会起作用。
Yes, this is possible. you need to extend BaseExpandableListViewAdapter and implement the methods in it. You also need to make the layout xml files for whatever you want to show and specify this to the adapter or inflate it yourself if you have more than one.
A good example is http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.html which is where the expandable list is the whole activity on the screen but if you extend it like how i said in a seperate file and include a ExpandableListView in your activity that will work as well.