- 博客(11)
- 收藏
- 关注
原创 ontouchevent浅谈
同一事件序列的概念:以down开始,up为止,中间包含若干个move;返回值如果为true,表示消耗此事件,同一事件序列都在此view上进行。返回值为false 表示不拦截,会向下传递(子View)。==============================================================ontouchlistener 的优先级高于(重写)on
2016-08-14 23:06:18 310 1
原创 android 获取手机联系人
ContentResolver contentResolver = getContentResolver();Cursor cursor =getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);while (cursor.mov
2016-08-08 00:27:29 426
原创 activity四种启动方式
standard: A-B-C-D-D 每启动一次就创建要给新的实例。singletop : 如果activity 没在栈顶 则创建一个实例, 如果在栈顶则不会创建实例,直接复用。singletask: 检查栈中是否有此activity,如果有则把栈里此activity上面的都清空。singleinstance :如果activity设置为此模式, 当创建实例后,会
2016-07-26 00:10:27 182
原创 对齐方式的解释
gravity: 子空间相对于本控件的对齐方式layout_gravity: 当前控件相对于父控件的对齐方式layout_margin: 当前空间相对于四周的对齐方式padding: 当前空间的子控件相对于 本控件的对齐方式
2016-07-20 00:54:09 387
转载 handler浅谈
本文转自: http://my.unix-center.net/~Simon_fu/?p=652class LooperThread extends Thread { public Handler mHandler; public void run() { Looper.prepare(); mHandler = new
2016-07-17 14:17:41 183
原创 fragment保存数据状态
View view=null;public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { if(view==null){ view=inflater.inflate(R.layout.fragment2, null
2016-06-22 23:51:07 402
原创 inflate(int resource, ViewGroup root, boolean attachToRoot)见解
inflate(int resource, ViewGroup root, boolean attachToRoot)view=inflater.inflate(R.layout.fragment1, null,false)的三个参数详解;第一个参数:加载view的布局文件。第二个参数:1.参数为空的情况,xml里的根布局(也就是最外层布局),将不会被加载(xml文件的根布
2016-06-22 23:37:51 771
原创 FragmentTabHost
xml布局文件:xml version="1.0" encoding="utf-8"?>LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="matc
2016-06-21 17:57:01 156
原创 DrawerLayout
DrawerLayout的布局文件:主内容区的布局代码要放在侧滑菜单布局的前面,这可以帮助DrawerLayout判断谁是侧滑菜单,谁是主内容区;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http
2016-06-20 21:15:55 249
原创 Handler笔记
Android规定 访问UI只能在主线程中进行,但又建议不要在主线程中进行耗时的操作 ,所以handler 提供了子线程访问主线程的方式。loop:UI线程默认生成Looper ,其他线程必须有LooperLooper.prepare();//中间new Handler 进行消息的获取操作mHandler = new Handler(){
2016-06-20 16:30:17 145
原创 popupwindow使用
popview=new mypopitem(mContext);//要显示的viewpopupWindow =new PopupWindow(popview,displayWidth, (int) (displayHeight*0.6));//view,宽度,高度popupWindow.setOutsideTouchable(true);popupWindow.setBackgroundDr
2016-06-19 19:49:45 156
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人