MobileApp > Android > Layout



Layout's Overview

縲縲縲The UI of application can be set by the combination of View and ViewGroup.



View and ViewGroup

縲縲縲繝サThe set of Veiw is ViewGroup.
縲縲縲繝サViewGroup contains two or more View.
縲縲縲繝サViewGroup can be contained in ViewGroup.
縲縲縲繝サThe layout inherit ViewGroup.
縲縲縲窶サRefer to the following succession charts for the practical visualization.


ViewGroup surrounding Class 縲縲

縲縲縲縲"ViewGroup" and its succession relations are described as follows.

縲縲ViewGroup.gif


Kind of layout


縲縲縲縲Typical View-Groups (layouts) are described as follows.

縲Absolute layout縲縲The layout placement which specifies the absolute coordinate.縲
竇。縲Relative layout縲縲The layout placement which specifies the relative coordinate.縲
竇「縲Linear縲 layout縲縲Horizontal direction and the vertical direction can be specified. 縲
竇」縲Table縲 layout縲縲The table form can be arranged. 縲
竇、縲Frame縲 layout縲縲Overlapping the VIEW is possible. 縲
縲the others縲


竇シ拶bsolute layout

縲縲縲縲繝サLayout specified by using [absolute coordinate]
縲縲縲縲繝サIt became non-recommendation from SDK1.5. シBecause this layout cannot support multiple devices for different screen sizes.シ


縲縲縲absolute.gif縲縲absolute2.gif


XML attribute which absolute coordinate is specified in

縲縲縲ス鯉スス呻ス擾ス包ス農ス倥
縲縲縲ス鯉スス呻ス擾ス包ス農ス吶


XML attribute which width and height of parts are specified in

縲縲縲ス鯉スス呻ス擾ス包ス農ス暦ス会スス費ス
縲縲縲ス鯉スス呻ス擾ス包ス農ス茨スス会スス茨ス
縲縲縲スス会ス鯉ス契ス撰スス抵スス趣ス is MAX size. ス暦ス抵スス神スス擾ス趣ス費スス趣ス is minimum size.



竇。シ山elative layout

縲縲縲縲Layout which specify the relative position of widget. Can be specified placed in the top or bottom.


縲縲縲relative.gifrelative2.gif

縲縲縲縲悟渕貅悶ョ菴咲スョ繧貞、画峩縺吶l縺ー縲√◎繧後↓莨エ縺縺サ縺九ョ繧ヲ繧」繧ク繧ァ繝繝医b閾ェ蜍慕噪縺ォ菴咲スョ縺瑚ェソ謨エ縺ァ縺阪k縲阪梧万繧√d蜀蠖「縺ォ繧る咲スョ縺悟庄閭ス縲阪→縺縺繝。繝ェ繝繝医′縺ゅk荳譁ケ縲
縲縲縲縲梧ー苓サス縺ォ繧ヲ繧」繧ク繧ァ繝繝医r霑ス蜉繝サ蜑企勁縺ァ縺阪↑縺縲阪√後←縺ョ繧医≧縺ォ繝ェ繝ャ繝シ繧キ繝ァ繝ウ縺輔○縺ヲ縺繧九°蛻縺九i縺ェ縺上↑縺」縺ヲ縺励∪縺縲阪→縺縺轤ケ縺後ョ繝。繝ェ繝繝医



竇「シ鮫inear layout

縲縲縲縲Liner Layout is the layout which arrange widgets at straight vertical or horizontal.

縲縲縲liner.gif縲縲縲縲縲縲縲liner2.gif



竇」シ撒able layout

縲縲縲This layout can arranged widget in a tabular.

縲縲縲tablelayout2.png縲縲縲縲tablelayout.png
縲縲縲縲縲縲縲Outline縲縲縲縲縲縲縲縲縲縲縲縲縲縲縲縲縲縲縲縲Screen




竇、シ薩rame layout

縲縲縲縲Frame layout is easy to use when stacking the View.
縲縲縲縲For example, when overlaying images is available.


縲縲縲FrameLayout01.gif縲縲縲縲FrameLayout02.gif
縲縲縲縲縲縲縲縲縲Outline縲縲縲縲縲縲縲縲縲縲縲縲縲縲縲縲縲縲縲縲Screen



Practical use

Half-and-half

縲縲縲hanbun.png
縲縲縲If you want to set half-and-half to buttons layout ,
縲縲縲Use "LinearLayout",and assign 0 to "layout_width",and assign 1 to "weight".

縲縲Example of layout.xml

   <LinearLayout 
       android:id="@+id/linearLayout1"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content">

       <Button
           android:layout_width="0dip"
           android:layout_weight="1"
           android:text="before" 
           android:id="@+id/Button01"
           android:layout_height="wrap_content" >
       </Button>

       <Button 
           android:layout_width="0dip"
           android:layout_weight="1"
           android:text="next" 
           android:id="@+id/Button02" 
           android:layout_height="wrap_content" 
           android:layout_alignParentRight="true">
       </Button>
   </LinearLayout>





Property of View

縲縲縲蜿り - Android Wiki

縲縲縲繝サス趣スス假ス費シヲス擾ス假ス包ス難シ、ス擾ス暦ス - 繝輔か繝シ繧ォ繧ケ縺御ク区婿蜷代↓驕キ遘サ縺励◆譎ゅョ驕キ遘サ蜈View繧貞ョ夂セゥ
縲縲縲繝サス撰スススス会ス趣ス - 荳贋ク句キヲ蜿ウ縺ョ繝代ョ繧」繝ウ繧ー繧定ィュ螳
縲縲縲繝サス難スス抵ス擾ス鯉ス鯉スゑスス抵シ。ス鯉ス暦スス呻ス難シ、ス抵スス暦シカスス抵ス費ス会ススス鯉シエス抵ススス - 繧ケ繧ッ繝ュ繝シ繝ォ繝舌シ繧定。ィ遉コ縺吶k縺九←縺縺


Property of ViewGroup

縲縲縲蜿り - Android Wiki



縲縲


Units of represent

縲縲縲Unit that can be used by layout

px縲pixels縲
dp縲Density Independent Pixels縲
sp縲Scale Independent Pixels縲
mm縲millimeter
pt縲Point縲
in縲Inch縲





Portrait and landscape layout

縲縲縲The Horizontal screen, Use "Layout-land" Folder.

layout-land.jpg



縲縲Back

     




Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes