- 博客(16)
- 资源 (3)
- 收藏
- 关注
原创 Service1.1
定义一个服务: package com.example.android_service; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; /** * @desc 自定义Service ...
2014-08-29 18:39:18 138
原创 Intent1.1
Intent intent = new Intent(); ComponentName comName = new ComponentName(MainActivity.this, MainActivity2.class); intent.setComponent(comName); startActivity(intent); 配置Action ...
2014-08-29 16:59:49 190
原创 SharedPreference
package com.example.android_shared_preference; import android.app.Activity; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.Bundle;...
2014-08-28 10:23:01 91
原创 横竖屏切换
// 切换横屏 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); // 切换竖屏 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); android:...
2014-08-28 10:22:58 109
原创 Layout1.9
GridView android:numColumns="auto_fit" 列数 自动设置 android:columnWidth="90dp" 列宽 android:verticalSpacing="10dp" 行间距 android:horizontalSpacing="10dp" 列间距 android:stretchMode="columnWidth" 缩放方式 pa...
2014-08-28 10:22:56 120
原创 Layout1.8
ListView刷新分页: package com.example.android_listview_activity; import java.util.ArrayList; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os...
2014-08-28 10:22:52 122
原创 Layout1.7
viewholder的使用 Adapter的作用就是ListView界面与数据之间的桥梁,当列表里的每一项显示到页面时,都会调用Adapter的getView方法返回一个View。 优化的思路两种: 1. View的重用 View的每次创建是比较耗时的,因此对于getview方法传入的convertView应充分利用 != null的判断 2.ViewHolder的应用 View的f...
2014-08-28 10:22:34 94
原创 Layout1.6
ListView BaseAdapter: package com.example.android_listview_activity; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.v...
2014-08-27 11:24:57 70
原创 Layout1.5
ListView图文列表: item模板 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:...
2014-08-27 11:03:08 83
原创 Layout1.4
ListView单选: package com.example.android_listview_activity; import android.app.Activity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; public ...
2014-08-27 10:35:53 92
原创 Layout1.3
android:layout_marginLeft="29dp" // 左边距 android:layout_marginTop="42dp" // 上边距 android:textSize="20sp" // 字体大小 android:text="@string/button1" 不要硬编码 控件用dp 字体用sp android:paddingLeft="40dp"...
2014-08-27 10:25:04 113
原创 Layout1.2
Relative Layout If you find yourself using several nested LinearLayout groups, you may be able to replace them with a single RelativeLayout. RelativeLayout is a view group that displays child vi...
2014-08-27 00:02:25 123
原创 Layout1.1
Write the XML Each layout file must contain exactly one root element, which must be a View or ViewGroup object <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http:...
2014-08-26 23:35:47 125
原创 Activity1.3
管理Activity的生命周期 你可以通过调用finish() 来终止activity An activity can exist in essentially three states: Resumed:The activity is in the foreground of the screen and has user focus(在屏幕的前面或者获取用户焦点) Pau...
2014-08-26 22:18:06 179
原创 Activity1.2
Starting an Activity You can start another activity by calling startActivity() The intent specifies either the exact activity you want to start or describes the type of action you want to perform ...
2014-08-24 23:42:54 126
原创 Activity1.1
An Activity is an application component that provides a screen with which users can interact in order to do something, such as dial the phone, take a photo, send an email, or view a map. An appl...
2014-08-24 22:54:19 198
java笔试题笔试题
2011-07-01
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人