- 浏览: 97736 次
- 性别:
- 来自: 杭州
最新评论
-
邱一河:
sinaoauth的web项目 下载不了啊,帮忙发个噻,谢谢啊 ...
新浪微博OAuth授权的Java实现 -
hety163:
受教了
Toast和Looper。Handler消息循环机制。 -
dcljava:
分析的不错!
Toast和Looper。Handler消息循环机制。 -
lxchuan:
我用sinaoauth的web项目,登录授权后,如何获取用户信 ...
新浪微博OAuth授权的Java实现 -
QinIce:
那如果是在2.2中怎么获取到安装时间呢?有什么好的方法没?
获得已安装程序的大小和时间
view 是一个数据结构,他的属性存储了LAYOUT参数,内容是一片特定的矩形区域。 在这片矩形区域上他处理自己Measurement,Layout,Drawing,FocusChange,Scrolling,Key/Gesure Adapters: AdapterView是一个ViewGroup的实现,定义了基于一个Adapter对象的他的子Views。 Adapter就像一个通讯员在你的数据源和AdapterView之间。 Declaring Layout 每一个ViewGroup都实现了自己的继承自ViewGroup.LayoutParams 的特定类 比如一个LinearLayout包含了一个RelativeLayout和其他几个View,RelativeLayout又包含了几个View那么定义RelativeLayout的Layout参数应该用LinearLayout.LayoutParams,而RelativeLayout中的孩子应该用RelativeLayout.LayoutParams.否则在容器在onLayout时会出现类型转换错误。 一个VIEW实际有俩组宽高。 第一组是measured width and measured height这俩个尺寸定了它想在他的父亲里多大。 The measured dimensions can be obtained by calling getMeasuredWidth() and getMeasuredHeight() . 第二组 width and height也被称作 drawing width and drawing height, 这组定义了VIEW在屏幕上的实际尺寸。 getWidth() and getHeight() . 这俩组可能不同。 测量VIEW尺寸时,也要考虑他的PADDING, Padding can be used to offset the content of the view by a specific amount of pixels. For instance, a left padding of 2 will push the view's content by 2 pixels to the right of the left edge. 但是VIEW没有提供MARGIN,但是VIEWGROUP提供了。 Handling UI Events ONTOUCHFrom View.OnTouchListener ,当按,释放,或者任何移动的手势动作在屏幕上。 onCreateContextMenu() From View.OnCreateContextMenuListener This is called when a Context Menu is being built (as the result of a sustained "long click"). Activity.dispatchTouchEvent(MotionEvent) - This allows your Activity to intercept all touch events before they are dispatched to the window. 其他的如BUTTON将不会被TAKE FOCUS。他们将简单的激活他们的ONCLICK。 TOUCH MODE 被整个系统(所有的WINDOWS,ACT)维护,为了查询当前状态call isInTouchMode() to see whether the device is currently in touch mode. VIEW可以通过isFocusable() 来指出他是否乐意接受焦点call setFocusable() .区改变。 当在TOUCH MODE中allows focus with isFocusableInTouchMode() . You can change this with setFocusableInTouchMode() . 如果VIEW不能获得FOUCS,你可以在申明时add the android:focusable XML attribute to the View, in your layout declaration. Set the value true . You can also declare a View as focusable while in Touch Mode with android:focusableInTouchMode . Building Custom Components 几乎确定的是去覆盖ONMEASURE,可能需要覆盖ONDRAW,如果你想SHOW一些东西。 默认的ONDRAW什么也不干,而ONMEASURE将中给你一个尺寸为100*100 还有一些其他的的ON...需要覆盖的 你的VIEW的ONMEASURE应该计算 measurement width and height,这俩个尺寸将被用来呈现VIEW 尺寸应该在参数(widthMeasureSpec and heightMeasureSpec )规定之内,当然他也可以选择去超过他们 如果超过了,PARENT能选择区做一些事情,包括including clipping, scrolling, throwing an exception, or asking the onMeasure() to try again, perhaps with different measurement specifications Once the width and height are calculated, the setMeasuredDimension(int width, int height) method must be called with the calculated measurements. The custom View is defined in the LabelView class. 创建一个compound component 1.创建一个集成LAYOUT的类,以组合框为例,我可以用一个LINEARLAYOUT带着水平方向的 当然你也可以嵌套LAYOUT,做成任意复杂的部件,可以用申明XML的方式去创建包含的部件,或者代码 2.在构造函数里,先调用SUPER构造函数,然后你在这里可以创建EditText field and the PopupList 注意,你可能在XML引入了你自己的属性参数,能在这被弄出来 3.创建一些事件侦听为他所包含的VIEW 4.可以为你自己的属性创建一些访问器。比如允许EDITETEXT值被设置。 5,如果继承了一个LAYOUT,你不需要覆盖onDraw() and onMeasure() 因为他们本身默认行为足够。也可以覆盖 The corresponding classes in the sample code are List4.java and List6.java . public static class MyEditText extends EditText This is a cleaner way to create inner classes if they do not need access to state from the outer class, keeps the generated class small, and allows it to be used easily from other classes (自定义的VIEW如果inflated from an XML layout file,那么应该是一个带参数的构造器(Context context, AttributeSet attrs)被调用 在你的构造函数里要记住先调用SUPER) 怎么用定制的VIEW呢,这里有一个例子 <view 沿着树,从上到下,每一个GROUP都负责请求他的孩子去画他自己(通过DRAW) 父亲总是最先画,然后是兄弟。 画LAYOUT是分俩个过程:MEASURE,LAYOUT MEASURE过程也是一个自顶向下的过程implemented in measure(int, int) 每一个VIEW推动尺寸规范在这个递归过程中,在MEASURE结束时候,每一个VIEW存储了他的MEASUREMENTS。 LAYOUT也同样,自顶向下。在这个过程中,每一个PARENT负责定位他的孩子用在MEASURE过程计算得到的尺寸。 When a View's measure() method returns, its getMeasuredWidth() and getMeasuredHeight() values must be set, along with those for all of that View's descendants MEASURE过程用俩个类去通信和DIMENSIONS, . The View.MeasureSpec class is used by Views to tell their parents how they want to be measured and positioned. The base LayoutParams class just describes how big the View wants to be for both width and height. For each dimension, it can specify one of: an exact number 当ACT开始呈现他的内容时,首先从根节点VIEWGROUP开始 画VIEWGROUP就是用MEASURE,LAYOUT去测量定位他的子VIEW,这个过程完了 VIEWGROUP会被调用 dispatchDraw,然后轮次调用VIEW的DRAW。 VIEWGROUP:ONMEASURE-->ONLAYOUT-->DISPATCHDRAW--> VIEW'S ONDRAW. viewgroup设了一个标志位防止自己被画,因为LAYOUT本身不需要画东西,你也能设置这个标志位 所以继承iewgroup实现ONDRAW,没有用。
每一个Layout文件必须只有一个根元素,或者是View,或者是ViewGroup
ONKEYFrom View.OnKeyListener , 被调用当用户焦点在此VIEW上,按或者释放一个KEY
ViewGroup.onInterceptTouchEvent(MotionEvent) - This allows a ViewGroup to watch events as they are dispatched to child Views.
ViewParent.requestDisallowInterceptTouchEvent(boolean) - Call this upon a parent View to indicate that it should not intercept touch events with onInterceptTouchEvent(MotionEvent) .
进入TOUCH模式后,只有 isFocusableInTouchMode() is true will be focusable, such as text editing widgets
1.继承VIEW,填充构造函数,在这你能拿属性参数从XML,
class="com.android.notepad.NoteEditor$MyEditText"
id="@+id/note"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:drawable/empty"
android:padding="10dip"
android:scrollbars="vertical"
android:fadingEdge="vertical" />
How Android Draws Views
当一个ACT接受到焦点时,将从这个LAYOUT的树层次的根节点开始画
FILL_PARENT , which means the View wants to be as big as its parent (minus padding)
WRAP_CONTENT , which means that the View wants to be just big enough to enclose its content (plus padding).
MeasureSpecs are used to push requirements down the tree from parent to child. A MeasureSpec can be in one of three modes:
发表评论
-
Android-surfaceView 与View 的区别
2011-03-28 15:34 1315如果你的游戏不吃CPU,用View就比较好,符合标准And ... -
Android Permission大全1.0最终版本
2011-03-21 10:24 1076android.permission.ACCESS_CHE ... -
设置组件状态--如何动态关闭manifest中的Receiver
2011-03-21 10:20 1981为什么要关闭组件? 在用到组件时,有时候我们可能暂时性的不使用 ... -
关于ListView中假如Button,EditText无法响应问题
2011-03-03 20:05 1887个人成功试验结果: 为Button或者EditText加上一 ... -
Android——Bitmap和Canvas
2011-03-01 12:50 1114位图是我们开发中最常用的资源,毕竟一个漂亮的界面对用户是最 ... -
Bitmap.createBitmap函数有6个重载方法
2011-03-01 10:37 4026位图剪切参考重载方 ... -
Android——PopupWindow
2011-02-28 16:37 2194实现PopupWindow透明效果,先在drawable定义一 ... -
Android——ProgressDialog
2011-02-26 21:15 1406ProgressDialog mProgressDial ... -
创建图片时内存溢出---java.lang.OutOfMemoryError: bitmap size exceeds VM budget
2011-02-16 22:17 2614android系统中读取位图Bitmap时.分给虚拟机 ... -
获取手机屏幕大小——DisplayMetrics
2011-01-13 09:21 937Displaymetrics 是取得手机屏幕大小的关键类,直接 ... -
Toast和Looper。Handler消息循环机制。
2011-01-12 20:43 32304(1) Looper类别用来为一个线程开启一个消息循环 ... -
Android应用程序变量,Application
2010-12-28 09:04 1247Android应用程序开发中,有的时候我们在应用程序的任何一个 ... -
Android上获取本机安装的应用程序
2010-12-24 10:00 2509List<PackageInfo> packs = ... -
获得已安装程序的大小和时间
2010-12-21 22:42 26641,通过PackageManager获得已安装程序: Li ... -
android用户界面编程技巧——如何使用Adapter
2010-12-21 13:03 2147adapte listview 数据源之间的关系图 ... -
APK签名
2010-12-20 17:08 5477刚学android,在windows xp ... -
ActivityManager
2010-12-20 16:56 1681ActivityManager mManager = ... -
ViewFlipper配合GestureDetector
2010-12-20 15:43 1342主要代码: /** * 用户按 ... -
任务管理相关
2010-12-19 21:57 12041)杀死后台一个进程: ActivityManager act ... -
使用SDCard相关操作
2010-12-18 09:36 920使用SDCard 清单注册: <!-- 在SDCar ...
相关推荐
Interface is directly facing the user, by modifying the UI interface of question bank, make the original system more delicate, easy to operate; In order to adapt to different age groups of teachers, ...
Customizable_SciFi_Holo_Interface_1.5.2 可定制的SciFi Holo接口(Unity超炫全息效果动画UI(基于UGUI)) 一个专门的组件自动处理子动画出现和消失的功能 -各种出现和闲置的动画为所有的元素,预先制定 -可以...
使用cocos2d-x编写的ui编辑器(界面编辑器),实现了ui的可视化编辑,支持sprite、button、label、scale9sprite等等,导出配置文件格式为json格式-Cocos2d-x prepared ui interface editor, ui visual editing ...
IBAnimatable 是一个帮助我们在 Interface Builder 和 Swift Playground 里面设计 UI, 交互, 导航模式, 换场和动画的开源库。
Jquery UI 1.8 The user interface library for Jquery
Custom Field component with validation for creating easier form-like UI from interface builder.zip,Custom Field component with validation for creating easier form-like UI from interface builder.
jQuery UI 1.8 The User Interface Library for jQuery 英语版
UI Guidelines for CRM WebClient User Interface
18 The Fundamentals of User Interface (UI) Design for Mobile
unity VR菜单界面UI资源包Curved UI - VR Ready Solution To Bend / Warp Your Canvas! 2.5p1 所支持的Unity版本:5.5.1 及以上版本 The only true curved interface system on asset store. Tested by thousands of...
unity3d_科幻UI_Customizable SciFi Holo Interface 1.6.2
而且,如果你喜欢编程的话,随时找到一个专业API (Application Programming Interface) 就可下手。 随着众多视频教程可用,你很快就能自己创建第一个 UI。开始创造并把你的点子带到世界! 自从 2015 年以来...
Easy UI Motion uses the new events system, that allow you to chain and manage the elements of your interface, without writing a line of code. Two Components : * Open/Close * Simple/Rewind Animate ...
jQuery UI 1.7 - The User Interface Library for jQuery 電子書
This is a simple UI interface calculator , Realize the basic computing functions 这是一个简单的UI界面计算器,实现了基本的计算功能
pyqt5编写的一个小界面,其中应用到了布局的知识,可以自适应窗口的大小,根据窗口大小的变化而自适应更改控件的大小