你好,游客 登录 注册 搜索
背景:
阅读新闻

百度贴吧布局框架的研究与实现(Android版本)

[日期:2012-08-12] 来源:Linux社区  作者:ace1985 [字体:大 中 小]

3、中间加载进度条的实现

既然介绍了上边的标题栏,下边的标签栏,那么中间部分也得说一说,就以加载进度条为例,效果如下图所示:

“我的贴吧”按钮对应的activity是LikeActivity,它的布局文件如下。在FrameLayout中布局了ListView和ProgressBar,且ProgressBar位于ListView的上层。

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <FrameLayout xmlns:Android="http://schemas.android.com/apk/res/android"  
  3.     android:layout_width="fill_parent"  
  4.     android:layout_height="fill_parent" >  
  5.   
  6.     <ListView  
  7.         android:id="@+id/home_lv_forum"  
  8.         android:layout_width="fill_parent"  
  9.         android:layout_height="wrap_content"  
  10.         android:background="@color/backgroundcolor"  
  11.         android:cacheColorHint="@color/backgroundcolor"  
  12.         android:divider="@drawable/list_divider"  
  13.         android:fadingEdge="none"  
  14.         android:listSelector="@drawable/list_selector" />  
  15.   
  16.     <ProgressBar  
  17.         android:id="@+id/home_progress_like"  
  18.         style="?android:attr/progressBarStyleInverse"  
  19.         android:layout_width="wrap_content"  
  20.         android:layout_height="wrap_content"  
  21.         android:layout_gravity="center"  
  22.         android:indeterminateDrawable="@drawable/progressbar"  
  23.         android:visibility="visible" />  
  24.   
  25. </FrameLayout>  
其中,android:indeterminateDrawable="@drawable/progressbar"用于指定进度条的显示的图片,progressbar.xml定义如下:
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:drawable="@drawable/loading"  
  4.     android:pivotX="50.0%"  
  5. android:pivotY="50.0%" />  
即实现图片loading围绕自身中心旋转的效果。loading图片如下图所示:


框架源码下载地址:

免费下载地址在 http://linux.linuxidc.com/

用户名与密码都是www.linuxidc.com

具体下载目录在 /2012年资料/8月/12日/百度贴吧布局框架的研究与实现(Android版本)

linux
相关资讯       Android源码 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款