中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

寶雞市城鄉(xiāng)建設(shè)規(guī)劃局官方網(wǎng)站活動策劃方案詳細(xì)模板

寶雞市城鄉(xiāng)建設(shè)規(guī)劃局官方網(wǎng)站,活動策劃方案詳細(xì)模板,成人自考本科要幾年,做網(wǎng)站后臺都要自己寫嗎一、RelativeLayout的概述 RelativeLayout(相對布局)是一種根據(jù)父容器和兄弟控件作為參照來確定控件位置的布局方式。在很多時候,線性布局還不能滿足我們的需求,比如,我們在一行(列)上顯示多個控…

一、RelativeLayout的概述

????????RelativeLayout(相對布局)是一種根據(jù)父容器和兄弟控件作為參照來確定控件位置的布局方式。在很多時候,線性布局還不能滿足我們的需求,比如,我們在一行(列)上顯示多個控件,這就需要使用RelativeLayout來進行相對布局,RelativeLayout允許子元素指定它們相對于其他元素或父元素的位置(通過ID指定)。因此,你可以以右對齊、上下或置于屏幕中央的形式來排列兩個元素。元素按順序排列,因此如果第一個元素在屏幕的中央,那么相對于這個元素的其他元素將以屏幕中央的相對位置來排列。如果使用XML來指定這個布局,在你定義它之前,被關(guān)聯(lián)的元素必須定義。RelativeLayout視圖顯示了屏幕元素的類名稱,下面是每個元素的屬性列表。這些屬性一部分由元素直接提供,另一部分由容器的LayoutParams成員(RelativeLayout的子類)提供。

在這里插入圖片描述

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent">......</RelativeLayout>

二、根據(jù)父容器定位

????????在相對布局中,可以通過以下的屬性讓的組合讓控件處于父容器左上角、右上角、左下角、右下角、上下左右居中,正居中等九個位置。屬性如下:

android:layout_alignParentLeft="true" 父容器左邊
android:layout_alignParentRight="true" 父容器右邊
android:layout_alignParentTop="true" 父容器頂部
android:layout_alignParentBottom="true" 父容器底部
android:layout_centerHorizontal="true" 水平方向居中
android:layout_centerVertical="true" 垂直方向居中
android:layout_centerInParent="true" 水平垂直都居中

在這里插入圖片描述

?示例1:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentStart="true"android:layout_alignParentTop="true"android:textSize="12sp"android:text="相對父容器上左" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerHorizontal="true"android:layout_alignParentTop="true"android:textSize="12sp"android:text="相對父容器上中" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentEnd="true"android:layout_alignParentTop="true"android:textSize="12sp"android:text="相對父容器上右" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentStart="true"android:layout_centerVertical="true"android:textSize="12sp"android:text="相對父容器中左" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerHorizontal="true"android:layout_centerVertical="true"android:textSize="12sp"android:text="相對父容器中中" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentEnd="true"android:layout_centerVertical="true"android:textSize="12sp"android:text="相對父容器中右" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentStart="true"android:layout_alignParentBottom="true"android:textSize="12sp"android:text="相對父容器下左" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerHorizontal="true"android:layout_alignParentBottom="true"android:textSize="12sp"android:text="相對父容器下中" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentEnd="true"android:layout_alignParentBottom="true"android:textSize="12sp"android:text="相對父容器下右" /></RelativeLayout>

示例1效果:

layout_centerInParent:水平垂直都居中即相對于父容器居中。

?三、根據(jù)兄弟控件定位

????????在相對布局中,還支持通過已確定位置的控件作為參考來確定其他控件的位置,以下的屬性讓的組合讓控件處于另外控件左上角、右上角、左下角、右下角、正上方、正下方、正左方、正右方等位置。屬性如下:

android:layout_toLeftOf="@+id/textview" 在textview控件左方

android:layout_toRightOf="@+id/textview" 在textview控件右方

android:layout_above="@+id/textview" 在textview控件上方

android:layout_below="@+id/textview" 在textview控件下方

android:layout_alignLeft="@+id/textview" 與textview控件左邊平齊

android:layout_alignRight="@+id/textview" 與textview控件右邊平齊

android:layout_alignTop="@+id/button1" 與button1控件上邊平齊

android:layout_alignBottom="@+id/button1" 與button1控件下邊平齊

在這里插入圖片描述

?示例2:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><Buttonandroid:id="@+id/button"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:textSize="12sp"android:text="已確定位置控件BUTTON" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="12sp"android:layout_centerInParent="true"android:layout_toStartOf="@+id/button"android:text="相對控件BUTTON居左"/><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="12sp"android:layout_centerInParent="true"android:layout_toEndOf="@+id/button"android:text="相對控件BUTTON居右"/><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="12sp"android:layout_centerInParent="true"android:layout_above="@+id/button"android:text="相對控件BUTTON居上"/><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:textSize="12sp"android:layout_centerInParent="true"android:layout_below="@+id/button"android:text="相對控件BUTTON居下"/></RelativeLayout>

示例2效果圖:

3.2 給一個控件添加?android:layout_toLeftOf="@+id/button1"?和layout_alignTop="@+id/button1"?屬性后該控件處于button1的正左方

?同理,layout_alignxxxx的屬性也是這樣的用法。

http://www.risenshineclean.com/news/53399.html

相關(guān)文章:

  • asp.net電子商務(wù)網(wǎng)站前臺模板搜索引擎營銷的優(yōu)勢
  • wordpress可以做外貿(mào)seo優(yōu)化推廣軟件
  • 網(wǎng)絡(luò)運維和網(wǎng)站開發(fā)聚合廣告聯(lián)盟
  • 事業(yè)單位 網(wǎng)站備案seo算法入門教程
  • 網(wǎng)站建設(shè)什么最重要seo推廣培訓(xùn)費用
  • 裝修設(shè)計軟件酷家樂seo排名第一
  • 鄭州網(wǎng)站推廣¥做下拉去118cr全網(wǎng)推廣外包公司
  • 百度如何做網(wǎng)站公司官網(wǎng)制作開發(fā)
  • 那種類型的網(wǎng)站可以自己做也可以賺錢百度關(guān)鍵詞優(yōu)化推廣
  • 做網(wǎng)站IP關(guān)鍵詞排名什么意思
  • 網(wǎng)站建設(shè)交易注冊域名在哪里注冊
  • 功能主機網(wǎng)站網(wǎng)站seo排名免費咨詢
  • 做外貿(mào)一定要獨立網(wǎng)站嗎seo內(nèi)容優(yōu)化是什么
  • 常熟做網(wǎng)站推廣的搜索引擎排名谷歌
  • 網(wǎng)站與建設(shè)實訓(xùn)報告有道搜索
  • pinterest wordpress廈門seo排名優(yōu)化方式
  • 企業(yè)做網(wǎng)站的申請報告優(yōu)化師的工作內(nèi)容
  • 能看外國網(wǎng)站的瀏覽器app開發(fā)用什么軟件
  • 張家港網(wǎng)站建設(shè)做網(wǎng)站引流獲客工具
  • 青島企業(yè)網(wǎng)站制作西安搜建站科技網(wǎng)站
  • 做網(wǎng)站著用什么軟件優(yōu)化什么
  • 微信網(wǎng)頁制作網(wǎng)站建設(shè)百度推廣開戶公司
  • 軟件技術(shù)主要學(xué)什么就業(yè)前景廣州專業(yè)seo公司
  • 一起做網(wǎng)店類似網(wǎng)站手機系統(tǒng)優(yōu)化
  • 南川網(wǎng)站建設(shè)珠海網(wǎng)站建設(shè)優(yōu)化
  • cnzz統(tǒng)計代碼放在后臺網(wǎng)站為什么沒顯示怎么下載app到手機上
  • 微信營銷和網(wǎng)站建設(shè)自媒體
  • 通過網(wǎng)站做詐騙立案嗎福州百度推廣電話
  • 網(wǎng)站怎么做網(wǎng)盤2022年最新十條新聞
  • 企業(yè)內(nèi)部網(wǎng)站源碼西安網(wǎng)站優(yōu)化推廣方案