摘要: 1,要善于运用0dp结合layout_weight来填充剩余空间2,对于高度,其实很多时候不需要高度必须为wrap_content;可以直接规定为具体数值3,多使用这个属性: android:gravity="center_vertical";这个结合上一条在很多时候很好用4,在listview、gridview等控件中,记得加上这个属性: android:cacheColorHint="@null"5,只有父标签为relativelayout的时候,控件才具有以下属性:android:layout_below、android:layout_alignP 阅读全文
posted @ 2013-07-12 17:31 bobo的学习笔记 阅读(171) 评论(0) 推荐(0) 编辑
摘要: package com.ctbri.weather.utils.calendar;/** * Created by IntelliJ IDEA. * User: zhouxin@easier.cn * 字符串的处理�? * Date: 12-11-22 * Time: 下午4:35 * To change this template use File | Settings | File Templates. */public class StringUtil { /** * 判断是否为null或空�? * * @param str String * @re... 阅读全文
posted @ 2013-07-12 09:51 bobo的学习笔记 阅读(513) 评论(0) 推荐(0) 编辑
摘要: 代码依旧非常简单,只不过因为这个方法极为常用,因此体现的还是封装的思想。package com.ctbri.weather.utils;import java.text.SimpleDateFormat;import java.util.Date;public class TimeUtil { public static String notifTimeFormat(long milliseconds) { SimpleDateFormat dateFormat = new SimpleDateFormat("h:mm a"); Date date = new... 阅读全文
posted @ 2013-07-12 09:48 bobo的学习笔记 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 之前碰到过这样的问题,sp文件只能够append,或者清空。其实一个键值,通过,分割,或者替代可以实现多条信息的存储。下面是一个举例:package com.ctbri.weather.utils;import android.content.SharedPreferences;public class StringUtil { public static String addIndex(SharedPreferences sp,String oldIndexs,String insertIndex) { if(oldIndexs.contains(insertIndex)... 阅读全文
posted @ 2013-07-12 09:43 bobo的学习笔记 阅读(949) 评论(0) 推荐(0) 编辑
摘要: 这个工具类非常简单,但是将显示dialog的方法统一封装,能够大大减少代码重复package com.ctbri.weather.utils;import android.app.AlertDialog;import android.app.Dialog;import android.app.ProgressDialog;import android.content.Context;public class ShowDialogActivity{ public static void showDialog(Context con){ Dialog dialog = new ... 阅读全文
posted @ 2013-07-12 09:38 bobo的学习笔记 阅读(554) 评论(0) 推荐(0) 编辑
摘要: 该类的目的主要是判断设备的联网状态检测设备是否连接了网络package com.wotlab.home.moneyplantairs.utils;import android.content.Context;import android.net.ConnectivityManager;import android.net.NetworkInfo;public class NetUtil { /** * 这个主要是判断当前用户设备的手机状态是否可用 * * @param context * @return */ public static b... 阅读全文
posted @ 2013-07-12 09:27 bobo的学习笔记 阅读(457) 评论(0) 推荐(0) 编辑
摘要: 封装的目的在于,只有处于调试状态的情况下,才进行日志的打印package com.ctbri.weather.utils;import android.util.Log;/** * 日志打印工具类,如果软件处于调试状态,允许打印相关日志,否则不允许, * 这也是很多api中设置setDebugMode的原因吧 * @author Tao * */public class LogUtil { public static boolean isDebug = true; public static void i(String tag, String message) { ... 阅读全文
posted @ 2013-07-12 09:25 bobo的学习笔记 阅读(372) 评论(0) 推荐(0) 编辑
摘要: 经验一,将几个页面公用的数据,和方法进行封装,形成一个baseActivity的类:package com.ctbri.weather.control;import java.util.ArrayList;import java.util.HashMap;import com.ctbri.weather.domain.AirInfo;import com.ctbri.weather.domain.AlertInfos;import com.ctbri.weather.domain.LifeIndex;import com.ctbri.weather.domain.MainData;import 阅读全文
posted @ 2013-07-12 09:18 bobo的学习笔记 阅读(1450) 评论(0) 推荐(0) 编辑