- 博客(17)
- 资源 (4)
- 收藏
- 关注
原创 AdapterView及其子类之四:基于ListView及SimpleAdapter实现列表
步骤如下:1、创建主布局文件<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layo
2013-11-20 10:04:24 1647
原创 AdapterView及其子类之三:基于ListView及ArrayAdapter实现列表
基本步骤如下:1、创建主布局文件,里面包含一个ListView元素。<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_pare
2013-11-19 22:35:10 1730
原创 AdapterView及其子类之二:使用ListActivity及ArrayAdapter创建列表
基本步骤如下:1、创建一个TextView,用于指定每一个ListView的格式<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list" android:layout_width="match_parent" android:layout_
2013-11-19 22:01:18 2193
原创 AdapterView及其子类之一:基本原理(ListView、ListActivity类型)
参考《疯狂android讲义》2.5节1、AdapterView一般用于显示列表项,其内容由Adapter提供。调用Adapter的setAdapter(Adapter)方法设置Adapter即可。AdapterView继承自ViewGroup,它的本质是容器。2、几个重点类的继承关系(1)Adapter:java.lang.Object
2013-11-19 21:26:22 1716
原创 Fragment之一:基本原理
1、低版本API对Fragment的支持Fragment必须被加载进Acitivity中,才能呈现。而在低于3.0版本的API中,由于不存在Fragment,因此必须使用support包:(1)对于1.6(API=4)及以上版本: 创建Fragment时,应该继承android.support.v4.app.Fragment; 创建Activity时,应该继承android.sup
2013-11-18 14:15:39 3639
原创 Loader之二:CursorLoader基本实例
参考APIDEMO:sdk\samples\android-19\content\LoaderCursor1、创建主布局文件,里面只包含一个Fragment。<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.c
2013-11-16 10:50:57 15678
原创 Loader之一:基本原理
参考APIDEMO及http://developer.android.com/guide/components/loaders.html#app1、Introduced in Android 3.0, loaders make it easy to asynchronously load data in an activity or fragment. Loaders have t
2013-11-16 10:29:54 3711
原创 Fragment之一:Fragment入门
参考自张泽华视频Fragment是自Android3.0后引入的特性,主要用于在不同的屏幕尺寸中展现不同的内容。Fragment必须被嵌入Activity中使用,总是作为Activity的组成部分。简单示例:一个Activity的界面由2个部分组成,每个部分分别是一个Fragment。1、创建第一个Fragment的界面文件。Fragment的界面文
2013-11-15 18:16:13 5934 2
原创 Github android客户端源代码分析之一:环境搭建
1、下载相应的包及项目,参考https://github.com/github/android/wiki/Building-From-Eclipse。2、若需查看某些包的源文件或者javadoc,则(以org.eclipse.egit.github.core-2.1.5.jar为例)(1)下载其源代码https://github.com/lujinhong/egit-github/tree
2013-11-12 22:47:09 5125
转载 如何在Eclipse中查看Android API源码以及support包源码
http://my.eoe.cn/futurexiong/archive/181.html开发第三方Android应用的,大多数人应该还是Eclipse结合ADT来开发。那么大多数时候我们可能希望点击API提供的一个类或者一个方法或者一个变量,从而进入API相关的源码中进行查看,用于Debug或者就是想阅读下API源码啥的,去下载对应版本的framework源码来看
2013-11-12 22:32:04 1636
原创 Intent七在属性之一:ComponentName
注:在《疯狂android讲义》中,此属性称为Component,官方文档中称为ComponentName。1、The name of the component that should handle the intent. This field is a ComponentName object — a combination of the fully qualified class nam
2013-11-10 10:54:37 3554 1
原创 Intent七大属性之总结
参考《疯狂android讲义》第5章1、Intent 用于封装程序的”调用意图“,不管想启动一个Acitivity、Service还是BroadcastReceiver,Android均使用统一的Intent对象来封装这种”启动意图“。很明显使用Intent提供了一致的编程模型。2、Intent还有一个好处,如果应用程序只是想启动具有某种特征的组件,并不想和某个具体的组件耦
2013-11-10 09:41:49 4849 1
原创 使用SQLiteHelper创建数据库并插入数据
参考《疯狂android讲义》8.4节P4241、获取SQLiteDatabase实例有2种方法,一是直接new SQLiteDatabase(),另一种使用SQLiteHelper。一般建议使用后者。使用SQLiteHelper插入数据的一般步骤:package com.ljh.sqllitehelperdemo.helper;import android.conte
2013-11-05 22:44:26 8266
原创 SharedPreferences基础
见归档项目:SharedPreferencesDemo.zip1、对于数据量较小,且有明显的K-V形式的数据而言,适合用SharedPreferences保存。2、写入SharedPreferences数据的基本步骤(1)获取SharedPreferences实例(2)通过SharedPreferences的实例获取Editor实例。注:SharedPreferen
2013-11-04 22:35:48 10612
原创 菜单之二:使用xml文件定义菜单
参考《疯狂android讲义》2.10节 P174,参见归档project:一般推荐使用XML文件定义菜单。基本步骤如下:1、定义布局文件为简单显示原理,本布局只有一个EditText<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:too
2013-11-03 09:39:00 2764
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人