日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

安卓前端布局Android,Android开发的几种常见布局

發布時間:2023/12/9 Android 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 安卓前端布局Android,Android开发的几种常见布局 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

目前正在從事iOS開發,對于安卓就是大學的時候自學了點,做過幾個小的項目,軟件外包大賽、計算機設計大賽、移動應用大賽都拿過獎項,呵呵。。。現在回想起來以前大學做的安卓比賽是多么的幼稚。 從現在開始我要從頭一步一步回顧安卓,作為一個前端開發工程師要崛起了。。。。哈哈。。。請大家支持的我創作,多提提寶貴的意見。

步入正題!!!!!!!

關于Android的幾種常見的布局其實很簡單的,是一個入門的關鍵。主要的線性布局(所有的ui控件都是 以一條線 線性的 方式去 排列的)、相對布局(所有的控件 都是 以相對的位置去放置)、其次表格布局、幀布局(就是頁面的疊加,播放器里經常用到)、絕對布局(已廢棄)。

關于布局就是xml文件里寫。可能有人會說那些標簽太多不好記,沒問題,不會的可以去控件里拖拽,時間長了子讓會記住了。我就拿例子來說吧。

線性布局寫的一個小米計算器

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical" >

android:layout_width="fill_parent"

android:layout_height="wrap_content"/>

android:layout_width="fill_parent"

android:layout_height="wrap_content">

android:text="C"

android:textColor="#FFC928"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:text="DEL"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:text="÷"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:text="×"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:layout_width="fill_parent"

android:layout_height="wrap_content">

android:text="7"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:text="8"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:text="9"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:text="—"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:layout_width="fill_parent"

android:layout_height="wrap_content">

android:text="4"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:text="5"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:text="6"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:text="+"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:orientation="horizontal">

android:layout_width="0dip"

android:layout_weight="3"

android:layout_height="wrap_content"

android:orientation="vertical" >

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:orientation="horizontal" >

android:text="1"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:text="2"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:text="3"

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:orientation="horizontal" >

android:text="0"

android:layout_width="0dip"

android:layout_weight="2"

android:layout_height="wrap_content"/>

android:text="."

android:layout_width="0dip"

android:layout_weight="1"

android:layout_height="wrap_content"/>

android:text="="

android:background="#F07A23"

android:layout_width="0dip"

android:layout_weight="1"

android:gravity="bottom|right"

android:layout_height="fill_parent"/>

android:id="@+id/toggleButton1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="ToggleButton" />

線性布局與相對布局混合使用做一個設置界面

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="#113965"

android:orientation="vertical"

tools:context=".MainActivity" >

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:background="#000000" >

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerVertical="true"

android:layout_marginLeft="10dp"

android:text="自動旋轉屏幕"

android:textColor="#ffffff" />

android:id="@+id/cbx"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentRight="true"

android:layout_centerVertical="true" />

android:layout_width="fill_parent"

android:layout_height="1dip"

android:background="#ff0000" />

android:id="@+id/seekBar"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:max="100"

android:visibility="visible" />

網格布局做的類似qq的登入頁面

android:layout_width="match_parent"

android:layout_height="match_parent" >

android:layout_width="fill_parent"

android:layout_height="wrap_content">

android:text="請輸入QQ"

android:layout_width="0dip"

android:layout_weight="2"

android:layout_height="wrap_content"/>

android:layout_width="0dip"

android:layout_weight="5"

android:layout_height="wrap_content"/>

android:layout_width="fill_parent"

android:layout_height="wrap_content">

android:text="請輸入QQ密碼"

android:layout_width="0dip"

android:layout_weight="2"

android:layout_height="wrap_content"/>

android:layout_width="0dip"

android:layout_weight="5"

android:layout_height="wrap_content"/>

android:text="登入"

android:layout_width="fill_parent"

android:layout_height="wrap_content"/>

絕對布局做的類似游戲鼠標的界面

android:layout_width="match_parent"

android:layout_height="match_parent" >

android:id="@+id/middle"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerHorizontal="true"

android:layout_centerInParent="true"

android:layout_centerVertical="true"

android:text="中間" />

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_above="@+id/middle"

android:layout_centerHorizontal="true"

android:text="上" />

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@id/middle"

android:layout_centerHorizontal="true"

android:text="下" />

android:id="@+id/button1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerVertical="true"

android:layout_toLeftOf="@id/middle"

android:text="左" />

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerVertical="true"

android:layout_toRightOf="@id/middle"

android:text="右" />

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="左上角" />

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true"

android:layout_alignParentLeft="true"

android:layout_marginLeft="14dp"

android:text="左下角" />

幀布局

android:layout_width="match_parent"

android:layout_height="match_parent" >

android:text=""

android:background="#ff0000"

android:layout_width="200dip"

android:layout_height="200dip"/>

android:text=""

android:background="#00ff00"

android:layout_width="100dip"

android:layout_height="100dip"/>

android:text=""

android:background="#0000ff"

android:layout_width="50dip"

android:layout_height="50dip"/>

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的安卓前端布局Android,Android开发的几种常见布局的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。