精通Android+UI设计阅读笔记(view和widget较详细介绍)

widgets位于布局容器内部即viewgroup的子类中,因此在android的布局文件中使用父标签定义布局容器,使用子标签填写布局容器中的用户界面widgets。可以嵌套布局容器,但是嵌套的布局容器会消耗更多的系统内存。
最外层的父标签必须是对XML命名空间的引用,在android中表示XML命名空间的是xmal:android参数,该标签包含了用于服务器HttP引用的全部标签定义。
动态得在java程序中更改布局参数需要用到类的公共构造函数
viewGroup的公共方法:resolveLayoutDirection(int LayoutDirection)
  包含两个常量LAYOUT_DIRECTION_LTR/RTL
  动态改变ViewGroup的参数需要用到他嵌套类的公共构造函数
  ViewGroup.LayoutParams
java.lang.Object
>ViewGroup.LayoutPArams:控制布局的嵌套类
  android:layout_width/height
>ViewGroup.MarginLayoutParams:边距嵌套类,上一个嵌套类的子类
  包含六个XML属性,android:layout_marginTop/Bottom/left/right/start/end
  在android4.2中添加RTL分支用marginStart和marginEnd参数取代marginLeft and marginRight.
  和RTL相关的公共方法;
  getLayoutDirection/setLayoutDirection/setMarginStart/getMarginStart/setMarginEnd/getMarginEnd
  还有:setMargin(left,right,top,bottom);

****************************************************************************************************************
以上的公共方法和嵌套类,ViewGroup的子类也有,viewGroup继承view类的间距参数,同时具边距margin和间距padding属性,而widgets仅有
从view继承的padding属性。间距和边距的区别,间距是控件内空白的距离,边距是两个控件间的距离.padding用于在widget内部添加间距
*******************************************************************************************************************
>java.lang.Object
>android.view.View类的直接子类。
  AnalogClock, ImageView, KeyboardView, ProgressBar, SurfaceView, TextView, ViewGroup, ViewStub
实现接口
  Drawable.Callback, KeyEvent.Callback
xml参数:
  android:rotation 用于根据XY轴的旋转参数rotationX,rotationY将一个视图围绕中心点进行旋转
  android:scaleX,android:scaleY用于缩放任何widget对象,使用浮点数值(0.0~1.0)
  android:translateX,android:translateY参数,用于在2D屏幕分辨率的任意方向上移动UI widget对象。
  android:alpha设置透明度
  android:visibility =VISIBLE\INVISIBLE\GONE,控制widget可见与否,设置为gone,布局容器不计算widget。而INVISIBLE则是设置其alpha=0,不可见。
  android:scrollX,andorid:scrollY和android:scrollbars,用于开关View widgets的滚动条,设置是否支持滚动。
  以及其他的一些scaollbar参数相关的参数
view的焦点:
  OnFocusChangeListener()是唯一一个与焦点有关的事件监听器,监听focusChange事件
  android:focusable设置为true表示widget将获得焦点
  android:focusableInTouchMode,设置为true,widget在触摸模式下会获得焦点
  android:nextFocus参数包括nextFocusForward,nextFocusUp,nextFocusDown,nextFocusLeft,nextFocusRight用于确定焦点从一个用户界面元素转移到另一个用户界面元素的顺序。
**************view监听器
View类的16个嵌套类中12个类似监听器接口
  OnClickLIstener,OnLongClickListener,OntouchListener,OnKeyListener
  OnDragListener用于拖放控制支持
  OnLayoutChangeListener检测布局容器变化
  OnHoverListener悬停监听事件,非点击,类似鼠标放在上面
  OnGenericMotionListener,用于运动事件发生时的触发,由android中的MotionEvent类进行处理。MotionEvent(运动事件,用于记录运动事件)保留两种不同类型的运动  数据,绝对或相对运动。可用于实现高级功能如手势控制。
android.view.Menu中常用menu接口介绍:
  OptionsMenus,ContextMenus,ActionBar,PopUpMenu.
  布局文件在res/menu中,在java代码中实例化,最后在菜单事件处理器为菜单项目功能添加程序逻辑
  <menu>-->Menu
  <item>-->MenuItem对象
  <group>添加逻辑组合将菜单分类,共享活动状态和可见性,可用.setGroupEnabled()激活或禁用分组中的全部选项菜单,setGroupVisible()显示或隐藏分组中的菜  单,setGroupCheckable()指定分组中菜单是否可选中
相应MenuItem的XML属性:android:id
  android:title 菜单文本标签
  android:titleCondensed 定义被截断或缩短的标签
  android:idcon 指定图标标签
  android:showAsAction 用于指定作为操作栏项目时如何显示 ifRoom never withText always
  android:onClick 用于指定点击事件处理器的名称(所有view对象都有),cool
  android:orderInCategory 按序展开
快捷键定义参数:
  android:alphabeticShortcut 在字母键盘定义一个键作为menuItem的快捷方式
  android:numericShortcut 在数字键盘定义一个键作为menuItem的快捷方式android:checkable 定义menuItem默认状态是否被选中

  android:visible
  android:enabled
  onOptionsItemSelected()菜单点击事件处理
关联菜单ContextMenu接口和弹出菜单PopupMenu类
java.lang.Object
>android.widget.PopupMenu
  有两个实际上是嵌套接口的嵌套类,一是PopupMenu.OnDismissListener,该回掉接口用于在用户关闭PopupMenu面板时通知应用。撤销(dismiss)
  PopupMenu.OnMenuItemClickListener,MenuItem点击事件响应接口。
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
  androidManifest.xml文件包含了用于android操作系统启动并初始化应用.apk文件的全部定义和权限
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
《精通Android+UI设计》目录
第一部分 Android UI设计的核心类介绍:开发工具、布局容器和Widgets
  第一章 Android UI设计工具:配置Android开发系统(1)
  第二章 Android UI布局:布局容器和ViewGroup类(26)
  第三章 Android UIWidgets:用户界面Widgets和View类(55)
第二部分
Android UI设计Menu类介绍:OptionMenu、ContextMenu、PopupMenu和ActionBar
  第四章 Android UI选项菜单:OptionsMenu 类和操作栏(86)
  第五章:Android UI本地菜单:ContextMenu类和PopupMenu类(117)
  第六章:Android Ui操作栏:高级操作栏设计和ActionBar类(138)
  第三部分
Android UI设计:UI布局考虑、Android操作系统设计概念和Android UI设计指南
  第七章 Android UI设计考虑:样式、目标屏幕密度和新媒体格式
  第八章 Android UI设计概念:线框图和UI布局设计模式(203)
  第九章 Android UI布局规范、差异和方法(228)
  第十章 Android Ui主题设计和数字媒体概念(250)
第四部分
基础Android Ui设计:基本布局容器FrameLayout、LinearLayout、RelativeLayout和GridLayout
  第11章 Android FrameLayout类:在UI设计中使用数字视频(286)
  第12章 Android LinearLayout类:水平和垂直UI设计(323)
  第13章 Android RelativeLayout类:使用一个布局容器进行UI设计(358)
  第14章 Android GridLayout类:利用网格布局进行Ui设计(380)
第五部分
高级Android UI设计:高级布局容器DrawerLayout、SlidingPane、ViewPager、PagerTitleStrip和PagerTabStrip
  第15章 Android DrawerLayout类:在UI设计中使用Ui抽屉(412)
  第16章 Android SlidingPaneLayout类:在UI设计中使用滑动面板(439)
  第17章 Android ViewPager类:利用ViewPager实现水平导航(463)
  第18章 Android PagerTitleStrip和PagerTabStri:ViewPager导航UI(482)

posted @ 2018-01-30 09:20  geekj  阅读(696)  评论(0编辑  收藏  举报