《Pro Android Graphics》读书笔记之第六节

Android UI Layouts: Graphics Design Using the ViewGroup Class 

Android ViewGroup Superclass: A Foundation for Layouts 

The ViewGroup LayoutParams Class: Layout Parameters

Deprecated Layouts: AbsoluteLayout and SlidingDrawer

absoluteLayout 3 version 1.5

SlidingDrawer 17 version 4.2(DrawerLayout  can replace

Android’s Experimental Layout: SlidingPaneLayout

“Experimental” means that the layout container could be removed at any time (实验意味着随时都可能被删除) 用例

logical UI design usage of the SlidingPaneLayout container should include pairings of panes with logical use bindings. An example of this would be a phone number list with related dial or tagging features, a city or street list with related map features, a contact list and UI allowing interaction with the contact, or a recent e-mail list with a content pane displaying the message in the selected e-mail.

support the use of weight layout parameter android:layout_weight

Android RelativeLayout Class: Designing Relative Layouts

Android LinearLayout Class: Designing Linear Layouts

To set a weight, use a zero if the layout container is not to be stretched or use a decimal number between 0.0 and 1.0 to prorate any of those extra pixels amongst all of the UI elements (child tags) within the container.

Android FrameLayout Class: Designing Frame Layouts

注意:

It is important to note that child tags (View widgets) that are currently invisible because they’ve been specified via an Android View.GONE constant instead of using View.INVISIBLE will be utilized for FrameLayout container sizing purposes only if the .setConsiderGoneChildrenWhenMeasuring() method is called using a true parameter.

Android GridLayout Class: Designing UI Layout Grids

add in level 14

The Android Space class is a lightweight View subclass that can be used to create empty space between user interface elements in layout containers like GridLayout

does not currently provide support for the parameter called weight(如果需要,请使用LinearLayout)

you should not need to use either of the Android size value constants WRAP_CONTENT or MATCH_PARENT when you are configuring the child tags (UI elements) within your GridLayout container.

可以和数据库数据混合使用

比TableLayout更省内存

可以和FrameLayout结合,做出更复杂的效果

As I mentioned earlier, basic FrameLayout configurations can be nested and accommodated inside the cells of a GridLayout because a single cell can contain multiple View or ViewGroup objects.

To switch between two View or ViewGroup objects, you would place both of them into the same cell, and then leverage each via a visibility parameter by using the constant GONE in order to switch between one ViewGroup to the other ViewGroup (or View) from inside your Java code.

The DrawerLayout Class: Designing UI Drawer Layouts

package:android.support. v4.widget

android:layout_gravity 

correspond to the side of the screen from which you want your UI Drawer to dragged out from

使用左右,而不能使用上下(Make absolutely sure not to use the TOP or BOTTOM (or any other constants) layout_gravity settings, as this class is not intended to provide vertical drawers, only horizontal ones, and will likely throw an exception.)

android:layout_height 

match_parent

android:layout_width

you would next use the fixed width that you want to use for the UI Drawer width, specified using a DIP value

DrawerLayout.DrawerListener

Java code can do things when the drawer is open, closed, or being dragged.

onDrawerClosed(),onDrawerOpened(),onDrawerSlide(),onDrawerStateChanged()

STATE_IDLE

STATE_DRAGGING,STATE-SETTLING,LOCK_MODE_UNLOCKED,LOCK_MODE_LOCKED_OPEN,LOCK_MODE_LOCKED_CLOSED

DrawerLayout.SimpleDrawerListener

Adding Menu Items to Access the UI Layout Container

顺序(android:orderInCategory)

Creating a Table of Contents Activity for Your UI Design

Creating an XML Table of Contents LinearLayout UI Design

Adding Text UI Widgets to the TOC UI Layout Container

Using onOptionsItemSelected( ) to Add Menu Functionality

Testing the Table of Contents Activity on the Nexus One


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值