• AbsoluteLayout

AbsoluteLayout–絕對佈局,顧名思義就是靠絕對座標(x及y軸座標)來擺放各元件的位置,雖然說對設計者來講可以很快速的設定好各元件的位置,但也因為如此一旦將手機從直擺改成橫擺後,整個UI也都會亂掉,而且每支手機的界面大小都不同,要確實呈現完整的UI界面實在很困難,因此目前此Layout方式已經很少被使用。

 

 AbsoluteLayout:

<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="10dp" android:paddingRight="10dp" android:paddingTop="10dp">

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button 1"
        android:layout_x="40dp"
        android:layout_y="275dp"/>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button 2"
        android:layout_x="100dp"
        android:layout_y="150dp"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="I am TextView"
        android:textSize="20dp"
        android:layout_x="200dp"
        android:layout_y="70dp"/>

</AbsoluteLayout>

 AbsoluteLayout                 AbsoluteLayout2  

因為使用絕對位置的關係,一旦直擺改成橫擺後,顯示上就會出現大問題。

 

觀看其它種Layout:

 

參考資料:Corn-Android學習手札iteye_android屌絲技術之旅

arrow
arrow
    全站熱搜

    fiend1120 發表在 痞客邦 留言(0) 人氣()