UI常用布局

UI常用的布局
LineaLayout:
线性布局
重要属性:
-orientation方向 分为水平,垂直
-layout-Weight(权重)
效果图//------------------------------

UI常用布局_第1张图片
image.png

--------------------------------代码如下-----------
···
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >










    


···
RelativeLayout
相对布局:
兄弟视图:同方向对齐,反方先对齐
与父视图之间:同方向对齐,居中
-----------效果图-------

UI常用布局_第2张图片
image.png

---------------------代码如下------------------
···

android:layout_width="match_parent"
android:layout_height="match_parent" >




···
FrameLayout
帧布局:
默认以屏幕左上角为(0,0)
-------------------效果图-----------


UI常用布局_第3张图片
image.png

----------------代码如下-------------------
···

android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_width="280dp"
android:layout_height="280dp"
android:background="#33FFFF"
android:layout_gravity="center"
/>
android:layout_width="220dp"
android:layout_height="220dp"
android:background="#33CCFF"
android:layout_gravity="center"
/>




···
属性的划分


UI常用布局_第4张图片
image.png

内边距与外边距

UI常用布局_第5张图片
image.png
UI常用布局_第6张图片
image.png

--------------效果图----------------

UI常用布局_第7张图片
image.png

-----------------------代码如下-----------------

android:layout_width="match_parent"
android:layout_height="match_parent" >




TableLayout:
表格布局:
---------------效果图------------


UI常用布局_第8张图片
image.png

---------------------代码如下-----------
···

android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="1241"
android:gravity="center"
android:layout_weight="1"
/>
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="哈哈"
android:gravity="center"
android:layout_weight="1"
/>


    
    
    
   
    

···
相对父视图定位


UI常用布局_第9张图片
image.png

相对兄弟视图定位:


UI常用布局_第10张图片
image.png

你可能感兴趣的:(UI常用布局)