2013年7月19日

集合排序 重写compare 方法

摘要: 数据排序输出 在应用中一般都会用到,用集合保存数据很是常见,一般两种形式:1. List 数组形式的集合 2. Map 键值对形式的集合对于第一种:都是Collection接口衍生出来的, List 保存的对象可重复 Set 不可重复;数据排序 可以构造比较器 按对象中某个元素来比较Collections.sort(guids, new Comparator() { @Override public int compare(Resource lhs, Resource rhs) { ... 阅读全文

posted @ 2013-07-19 16:32 杀#嘻哈 阅读(1906) 评论(0) 推荐(0) 编辑

2013年7月17日

static 关键字

摘要: 在做应用的过程中不可避免的会碰到解析数据的情况,而且如果用JSON 解析 成对象形式 就会经常出现 多层集合嵌套的情况,如果想访问集合对象中的数据 就得加关键字 static,虽然 是小问题 但这种情况 经常出现 容易出错。public class StaffListResponse extends BaseResponse { private String hotline; @JSONField(name = "res") private List resources; public static class Resource implements Serializabl 阅读全文

posted @ 2013-07-17 10:11 杀#嘻哈 阅读(119) 评论(0) 推荐(0) 编辑

2013年7月12日

android 软件盘打开 关闭

摘要: 点击按钮关闭软件盘 public static void hideSoftInput(Activity acitivity) { LogUtil.d("hideSoftInput"); InputMethodManager imm = (InputMethodManager) acitivity .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(acitivity.getWindow().getDecorView() .getApplicationWindowToken( 阅读全文

posted @ 2013-07-12 17:35 杀#嘻哈 阅读(392) 评论(0) 推荐(1) 编辑

tableLayout 属性 ; 背景选择属性

摘要: TableLayout的布局属性:android:stretchColumns="1" (设置TableLayout的所有行的第二列为扩展列,第一列后的其余空间由第二列补齐)控件选中效果,xml文件设置:/res/drawable/widget_input.xmlandroid:drawable放一个drawable资源android:state_pressed 是否按下,如一个按钮触摸或者点击。android:state_focused 是否取得焦点,比如用户选择了一个文本框。android:state_hovered 光标是否悬停,通常与focused state相同, 阅读全文

posted @ 2013-07-12 14:25 杀#嘻哈 阅读(402) 评论(0) 推荐(0) 编辑

导航