- 浏览: 1820312 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (665)
- 闲话 (17)
- ruby (1)
- javascript (40)
- linux (7)
- android (22)
- 开发过程 (11)
- 哥也读读源代码 (13)
- JVM (1)
- ant (2)
- Hibernate (3)
- jboss (3)
- web service (17)
- https (4)
- java基础 (17)
- spring (7)
- servlet (3)
- 杂记 (39)
- struts2 (10)
- logback (4)
- 多线程 (2)
- 系统诊断 (9)
- UI (4)
- json (2)
- Java EE (7)
- eclipse相关 (4)
- JMS (1)
- maven (19)
- 版本管理 (7)
- sso (1)
- ci (1)
- 设计 (18)
- 戒烟 (4)
- http (9)
- 计划 (4)
- HTML5 (3)
- chrome extensions (5)
- tomcat源码阅读 (4)
- httpd (5)
- MongoDB (3)
- node (2)
最新评论
-
levin_china:
勾选了,还是找不到
用spring annotation声明的bean,当打包在jar中时,无法被扫描到 -
GGGGeek:
我用的maven-3.5.0,还没有遇到这种情况,使用jar ...
用spring annotation声明的bean,当打包在jar中时,无法被扫描到 -
GGGGeek:
受益匪浅,从组织项目结构,到技术细节,讲的很到位,只是博主不再 ...
一个多maven项目聚合的实例 -
Aaron-Joe-William:
<?xml version="1.0" ...
hibernate逆向工程 -
li272355201:
http://archive.apache.org/dist/ ...
tomcat源码阅读(一)——环境搭建
先上效果图:
下面详细说说这个页面是怎么做出来的:
1、这个页面最下方可以看到一个TAB页签,分别是“主页”、“提及”等等,这个是一个在底部的TAB分页样式,在上一篇博客中已经介绍了
2、这个页面就是“主页”这个子页面,是嵌入到上面说的TAB布局中的。由3个部分组成,分别是最上面的状态栏(包含2个按钮,和一个文本区)、中间的列表、最下方的“更多”按钮(当更多按钮点击时,会加载更多数据,并且出现LOADING提示)
上面这段代码,就生成了列表,和顶部的状态栏。顶部的状态栏是通过<include>标签引入的
是一个最简单的横向排列布局,就不用多介绍了
3、然后是这个FooterView是怎么添加进来的,看代码
通过ListView.addFooterView()方法,来给列表添加一个FooterView,而这个FooterView,也是来自一个layout xml
这个FooterView包含一个“更多”的文本框,和一个“读取中”文本框。这里我没弄明白的是,为什么一开始默认只会显示“更多”,读取栏不会显示出来,需要
这样做,才能让“更多”按钮消失,显示出“读取中”,希望知道的朋友给我讲解一下。
通过上面的代码,就可以做出效果图里的页面了。
最后谈一下感想,我感觉android的布局还是比较难的,除了对各种View和ViewGroup对象的特性和API都要比较熟悉之外,还要对xml里各种android:xxx的属性都比较清楚,才能做出各种布局和样式的页面来。
不像CSS就比较简单,基本上只要弄明白BOX模型和组件嵌套的原理,以及float等比较特殊的处理,就可以做出想要的页面了,而且CSS的属性又比较少,大概就30多个,多用几次就十分熟练了。android光是android:xxx就有好多,我现在也没熟练掌握几个,还得多加油才行
下面详细说说这个页面是怎么做出来的:
1、这个页面最下方可以看到一个TAB页签,分别是“主页”、“提及”等等,这个是一个在底部的TAB分页样式,在上一篇博客中已经介绍了
2、这个页面就是“主页”这个子页面,是嵌入到上面说的TAB布局中的。由3个部分组成,分别是最上面的状态栏(包含2个按钮,和一个文本区)、中间的列表、最下方的“更多”按钮(当更多按钮点击时,会加载更多数据,并且出现LOADING提示)
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:background="#ffffffff" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" /> <include android:id="@+id/head_line" layout="@layout/head_line" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <ListView android:cacheColorHint="#00000000" android:id="@id/android:list" android:layout_width="fill_parent" android:fastScrollEnabled="false" android:layout_height="wrap_content" android:paddingTop="45.0dip" android:fadingEdge="none" android:paddingBottom="50.0dip" android:divider="@drawable/list_divider" android:clipToPadding="false" /> </FrameLayout>
上面这段代码,就生成了列表,和顶部的状态栏。顶部的状态栏是通过<include>标签引入的
<RelativeLayout android:background="@drawable/header" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android"> <Button android:id="@+id/top_btn_left" android:textColor="@color/button_text_selector" android:background="@drawable/top_refresh_selector" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="12.0dip" android:layout_alignParentLeft="true" android:layout_centerVertical="true" /> <Button android:id="@+id/top_btn_right" android:textColor="@color/button_text_selector" android:background="@drawable/top_edit_selector" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="12.0dip" android:layout_alignParentRight="true" android:layout_centerVertical="true" /> <TextView android:id="@+id/top_title" android:textSize="22.0sp" android:textColor="@color/head_line_text" android:ellipsize="middle" android:gravity="center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/user_name" android:singleLine="true" android:layout_toLeftOf="@id/top_btn_right" android:layout_toRightOf="@id/top_btn_left" android:layout_centerInParent="true" android:layout_alignWithParentIfMissing="true" /> </RelativeLayout>
是一个最简单的横向排列布局,就不用多介绍了
3、然后是这个FooterView是怎么添加进来的,看代码
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home); setUpViews();// 设置视图 setUpListeners();// 设置侦听器 fillInitData();// 填充初始化数据 } /** * 设置视图 */ private void setUpViews() { listView = getListView();// 得到ListView listFooter = (LinearLayout) LayoutInflater.from(this).inflate( R.layout.list_footer, null); listView.addFooterView(listFooter);// 添加FooterView more = (TextView) findViewById(R.id.more); loading = (LinearLayout) findViewById(R.id.loading); }
通过ListView.addFooterView()方法,来给列表添加一个FooterView,而这个FooterView,也是来自一个layout xml
<?xml version="1.0" encoding="UTF-8"?> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:minHeight="?android:listPreferredItemHeight" xmlns:android="http://schemas.android.com/apk/res/android"> <TextView android:textSize="16.0sp" android:textColor="#ff545454" android:gravity="center" android:id="@+id/more" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/more" /> <LinearLayout android:gravity="center" android:layout_gravity="center" android:orientation="horizontal" android:id="@+id/loading" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ProgressBar android:layout_gravity="center_vertical" android:id="@+id/footprogress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:indeterminateBehavior="repeat" style="?android:progressBarStyleSmallInverse" /> <TextView android:textColor="#ff000000" android:gravity="left|center" android:padding="3.0px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/loading" /> </LinearLayout> </LinearLayout>
这个FooterView包含一个“更多”的文本框,和一个“读取中”文本框。这里我没弄明白的是,为什么一开始默认只会显示“更多”,读取栏不会显示出来,需要
more.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { more.setVisibility(View.GONE); loading.setVisibility(View.VISIBLE); } });
这样做,才能让“更多”按钮消失,显示出“读取中”,希望知道的朋友给我讲解一下。
通过上面的代码,就可以做出效果图里的页面了。
最后谈一下感想,我感觉android的布局还是比较难的,除了对各种View和ViewGroup对象的特性和API都要比较熟悉之外,还要对xml里各种android:xxx的属性都比较清楚,才能做出各种布局和样式的页面来。
不像CSS就比较简单,基本上只要弄明白BOX模型和组件嵌套的原理,以及float等比较特殊的处理,就可以做出想要的页面了,而且CSS的属性又比较少,大概就30多个,多用几次就十分熟练了。android光是android:xxx就有好多,我现在也没熟练掌握几个,还得多加油才行
发表评论
-
最近半个月开发小结
2011-12-05 22:16 12751、有一个方法,有一段 ... -
android培训文档提纲(四)
2011-11-27 23:28 12101、生命周期方法onSaveInstanceState()是在 ... -
Tasks and Back Stack
2011-11-22 23:47 1141Even though the activities may ... -
上周开发过程中几个简单问题的总结
2011-11-21 13:18 1323上周开发中组员遇到几个问题,都不是大问题,但都耽搁了一些时间。 ... -
android培训文档提纲(三)
2011-11-12 23:47 17341、Activity和Service组件是Context的子类 ... -
android的Log组件和logcat命令
2011-11-12 23:03 6277项目进入开发阶段了, ... -
android培训文档提纲(二)
2011-11-07 21:10 1630一、Each Activity can make an ... -
android培训文档提纲(一)
2011-10-23 14:05 1566最近项目快要进入开发 ... -
实现屏幕下方展示的TAB分页
2011-08-09 23:22 2140这篇博客是参考helloandroid兄的腾讯微博应用,我整理 ... -
PendingIntent
2011-08-08 16:02 1523在开发SMS等应用时,有时调用相关的API会要求提供一个类型为 ... -
android数据持久化总结
2011-08-06 12:23 18961、 通过Context.getSharedPreferenc ... -
intent and service
2011-08-04 00:07 1395明天才开始讨论包需求 ... -
最近两周android总结
2011-08-01 23:42 1576最近2周预研做得差不多 ... -
没有单元测试,怎能写代码
2011-07-25 17:56 1539项目前期的技术点预研完成了,最近开始做原型开发。 之前没有在 ... -
android process and thread
2011-07-18 16:31 1650前三周android预研中,把可能用到的技术点都识别了,并完成 ... -
android第三周小结
2011-07-18 10:16 13311. 系统自带的通讯录应用,联系人名单保存在data/data ... -
onPause()方法的特殊性
2011-07-15 17:11 2900onPause(), onStop(), onDestroy( ... -
activity存在的三种状态
2011-07-15 16:44 1735An activity can exist in essent ... -
android第二周小结
2011-07-14 10:50 11351. 做了短信侦听的Broadca ... -
android一周小结
2011-07-04 21:26 1199做了一周android预研,总结以下几条: 1. 用DDMS ...
相关推荐
C# 下重载ListView 添加按钮列
实现了ListView添加图片、按钮并添加了ListView跟Button 的双监听,Button实现的是Activity的跳转
Android中ListView 左滑出现删除按钮,点击按钮删除ListView的item条目.出现删除按钮还有动画效果,点击删除按钮消失时也有动画
在listview中添加按钮,并监听相应事件,可以加上自己的方法。
listview内容超出屏幕高度,自动显示回到listview顶部的按钮,点击按钮自动返回到listview顶部,代码附有注释,简单易懂
Android ListView每个Item上面的有TextView和Button,为ListView每个Item上面的按钮添加事件,并获取TextView文本信息。
带按钮的listview的demo,每一个item带button........
含按钮的ListView事件响应,这个可以搞定,其他的ListView就更没问题了。
具体是:每当点一次按钮就会在ListView中添加一条信息;当点击每一条信息时,会弹出一个“编辑”和“删除”的操作,这里只实现了简单的操作,具体需要什么业务操作,直接加在里边即可运行成功。
listview 上有两个按钮 一个编辑文本 一个按钮为加 一个为减 编辑文本为只读 触发按钮事件 文本相应变化
仿qq页面的listview 比较炫
使用tablelayout和fragment结合的顶部导航栏的方法对几种模式进行分类,在使用list view将几种操作方法进行适配,对listview中的多个按钮相应不同的方法,输出指令。 有兴趣可以看看这篇博客:...
1、点击ListView中其中的一项,Item中处于隐藏状态的操作按钮部分布局显示,其他项显示的布局同时被隐藏,再次点击该项,操作按钮部分布局再次隐藏。 2、点击各个按钮,分别弹出哪个按钮被点击(也就是点击每一个...
ListView像左滑动Item显示删除按钮
listview的一种联动效果
Android Listview 按钮点击相应状态混乱之解决办法。
对于Listview未满一屏添加footerView 满了一屏幕将View固定在屏幕下方的解决方案
TestListView(ListView中的头尾按钮):listView中顶端和底部的按钮。
《用Fragment实现Listview顶部停靠,参考 StickyListHeaders》 参考地址: http://blog.csdn.net/xiechengfa/article/details/39005775 1.演示如上。 2.自动切换两个fragment(里面切换数据和 listview) 3.滑动...
一个ListView的Item带单选按钮,并实现响应各自的事件。