ZNDS智能电视网 推荐当贝市场

TV应用下载 / 资源分享区

软件下载 | 游戏 | 讨论 | 电视计算器

综合交流 / 评测 / 活动区

交流区 | 测硬件 | 网站活动 | Z币中心

新手入门 / 进阶 / 社区互助

新手 | 你问我答 | 免费刷机救砖 | ROM固件

查看: 16422|回复: 0
上一主题 下一主题
[教程]

第四十三讲:用户界面 View(十)

[复制链接]
跳转到指定楼层
楼主
发表于 2013-8-28 16:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
>
本讲内容:ExpandableListView,ExpandableListActivity 可扩展列表 二级列表 手风琴效果accordion
本讲源代码下载:
  
点击一级列表,展开下一级:
  
点击二层列表(嵌套的列表)的某一项:
   
下面我们来看代码:
1、新建一个项目 Lesson43_ExpandableListView
2、main.xml 的内容如下:
   
  1. <?xml version="1.0" encoding="utf-8"?>   
    <linearlayout android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">   
            <expandablelistview android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@id/android:list">   
            </expandablelistview>   
    </linearlayout>
复制代码
请注意ExpandableListView标签中id的写法是固定的@id/android:list,因为我们这里用的是ExpandableListActivity,而ExpandableListActivity代码里写死了要寻找的UI元素是它,这和我们以前讲的很多特殊的Activity是一样的,这里再稍作提醒。3、MainActivity.java的代码如下,解释在注释里:   
复制代码
  4、编译并运行程序即可看到上面的效果。那么本节课就到这里了,Android中很多内容就像本节的ExpandableListView一样讨厌,来,我们一起鄙视一下^_^   
</div

上一篇:android的消息推送
下一篇:android_下拉菜单.docx
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

Archiver|新帖|标签|软件|Sitemap|ZNDS智能电视网 ( 苏ICP备2023012627号 )

网络信息服务信用承诺书 | 增值电信业务经营许可证:苏B2-20221768 丨 苏公网安备 32011402011373号

GMT+8, 2025-7-28 17:48 , Processed in 0.060284 second(s), 13 queries , Redis On.

Powered by Discuz!

监督举报:report#znds.com (请将#替换为@)

© 2007-2025 ZNDS.Com

快速回复 返回顶部 返回列表