五大Ui布局

image.png
image.png
image.png

線性布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/to"
         >

    </EditText>

    <EditText
        android:id="@+id/editText2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/subject"
         />

    <EditText
        android:id="@+id/editText3"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:gravity="top"
        android:hint="@string/message"
      />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <Button
            android:id="@+id/button1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Button" />
        <Button
            android:id="@+id/button2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Button" />

    </LinearLayout>

</LinearLayout>
image.png

相對(duì)布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:hint="@string/to"
        android:ems="10" >
    </EditText>
    <Button 
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/editText1"
        android:layout_alignRight="@id/editText1"
        android:text="@string/message"
        />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/editText1"
        android:layout_toLeftOf="@+id/button"
        android:layout_marginRight="20dp"
        android:text="Button" />

    <EditText
        android:id="@+id/editText2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/button"
        android:layout_centerHorizontal="true"
        android:ems="10" />
    
</RelativeLayout>
image.png

幀布局

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <TextView 
        android:layout_width="280dp"
        android:layout_height="280dp"
        android:background="#33ffff"
        android:layout_gravity="center"
        
        />
    
    <TextView 
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:background="#3366ff"
        android:layout_gravity="center"
        
        />
     <TextView 
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#33ffff"
        android:layout_gravity="center"
        
        />

</FrameLayout>
image.png
image.png
image.png
image.png

表格布局

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <TableRow 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
        <TextView 
             android:layout_width="0dp"
        android:layout_height="wrap_content"
            android:text="@string/app_name"
            android:layout_weight="1"
            android:gravity="center"
            />
         <TextView 
             android:layout_width="0dp"
        android:layout_height="wrap_content"
            android:text="@string/app_name"
            android:gravity="center"
            android:layout_weight="1"
            />
        
        
    </TableRow>

</TableLayout>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末忙灼,一起剝皮案震驚了整個(gè)濱河市畦贸,隨后出現(xiàn)的幾起案子忽你,更是在濱河造成了極大的恐慌松邪,老刑警劉巖吕嘀,帶你破解...
    沈念sama閱讀 218,546評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件兽间,死亡現(xiàn)場(chǎng)離奇詭異谒臼,居然都是意外死亡会烙,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,224評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門韭赘,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)缩滨,“玉大人,你說(shuō)我怎么就攤上這事泉瞻÷雎” “怎么了?”我有些...
    開封第一講書人閱讀 164,911評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵袖牙,是天一觀的道長(zhǎng)侧巨。 經(jīng)常有香客問(wèn)我,道長(zhǎng)鞭达,這世上最難降的妖魔是什么司忱? 我笑而不...
    開封第一講書人閱讀 58,737評(píng)論 1 294
  • 正文 為了忘掉前任,我火速辦了婚禮畴蹭,結(jié)果婚禮上坦仍,老公的妹妹穿的比我還像新娘。我一直安慰自己叨襟,他們只是感情好繁扎,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,753評(píng)論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著芹啥,像睡著了一般锻离。 火紅的嫁衣襯著肌膚如雪铺峭。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,598評(píng)論 1 305
  • 那天汽纠,我揣著相機(jī)與錄音卫键,去河邊找鬼。 笑死虱朵,一個(gè)胖子當(dāng)著我的面吹牛莉炉,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播碴犬,決...
    沈念sama閱讀 40,338評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼絮宁,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了服协?” 一聲冷哼從身側(cè)響起绍昂,我...
    開封第一講書人閱讀 39,249評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎偿荷,沒(méi)想到半個(gè)月后窘游,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,696評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡跳纳,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,888評(píng)論 3 336
  • 正文 我和宋清朗相戀三年忍饰,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片寺庄。...
    茶點(diǎn)故事閱讀 40,013評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡艾蓝,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出斗塘,到底是詐尸還是另有隱情赢织,我是刑警寧澤,帶...
    沈念sama閱讀 35,731評(píng)論 5 346
  • 正文 年R本政府宣布馍盟,位于F島的核電站敌厘,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏朽合。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,348評(píng)論 3 330
  • 文/蒙蒙 一饱狂、第九天 我趴在偏房一處隱蔽的房頂上張望曹步。 院中可真熱鬧,春花似錦休讳、人聲如沸讲婚。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,929評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)筹麸。三九已至活合,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間物赶,已是汗流浹背白指。 一陣腳步聲響...
    開封第一講書人閱讀 33,048評(píng)論 1 270
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留酵紫,地道東北人告嘲。 一個(gè)月前我還...
    沈念sama閱讀 48,203評(píng)論 3 370
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像奖地,于是被迫代替她去往敵國(guó)和親橄唬。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,960評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容