干熟妇在线视频午夜剧场一级A级|99成人香视频日本两性激情视频|久久 午夜福利无码精品人妻一区|热久久超碰精品精品少妇一区二区|五月天综合在线国产一区免费视频|亚洲成人中心热re久久99|亚洲国产怡红院丁香五月综合h|玖玖九久久久午夜射精视频

十年專注于品牌網站建設 十余年專注于網站建設_小程序開發(fā)_APP開發(fā),低調、敢創(chuàng)新、有情懷!
南昌百恒網絡微信公眾號 掃一掃關注
小程序
tel-icon全國服務熱線:400-680-9298,0791-88117053
掃一掃關注百恒網絡微信公眾號
掃一掃打開百恒網絡微信小程序

百恒網絡

南昌百恒網絡

線性布局(linearlayout)與相對布局(relativelayout)的結合使用實例

百恒網絡 2014-10-20 15258

在做參數設置時我們需要實現一小塊區(qū)域的文字加上復選框或單選框,讓用戶設置參數,在一個頁面上有多個參數要設置,那就需要多個區(qū)域,如圖所示,像這樣的布局我們一般怎么實現呢?接下來由百恒網絡工程向大家介紹,線性布局(linearlayout)與相對布局(relativelayout)結合使用方法。

1.我們先看一個簡單的相對布局(relativelayout)。

線性布局與相對布局實現參數設置實例

? ? ? xmlns:tools="http://schemas.android.com/tools"
? ? android:layout_width="match_parent"
? ? android:layout_height="100dp" ??
? ? android:background="#000000"
? ? tools:context="cn.jxbh.commonlayout.MainActivity" >

? ? ? ? ? ? android:id="@+id/tv1"
? ? ? ? android:layout_width="wrap_content"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:layout_alignParentLeft="true"
? ? ? ? android:layout_alignParentTop="true"
? ? ? ? android:layout_marginTop="14dp"
? ? ? ? android:textSize="20sp"
? ? ? ? android:textColor="#ffffff"
? ? ? ? android:text="About Baiheng"
? ? ? ? ?/>

? ? ? ? ? ? android:id="@+id/tv2"
? ? ? ? android:layout_width="240dp"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:layout_alignParentLeft="true"
? ? ? ? android:layout_below="@+id/tv1"
? ? ? ? android:layout_alignLeft="@id/tv1"
? ? ? ? android:textSize="14sp"
? ? ? ? android:textColor="#88ffffff"
? ? ? ? android:text="Baiheng Software was founded in 2006, specializing in software development companies. detailed ..."
? ? ? ? />

? ? ? ? ? ? android:id="@+id/checkBox1"
? ? ? ? android:layout_width="wrap_content"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:layout_alignParentRight="true"
? ? ? ? android:layout_centerVertical="true" ? ??
? ? ? ? android:layout_marginRight="24dp"
? ? ? ? android:text="" />


相對布局(relative layout)實現實例
2.我們在線性布局中嵌套入相對布局,代碼如下。

? ? android:layout_width="match_parent"
? ? android:layout_height="match_parent"
? ? android:paddingBottom="@dimen/activity_vertical_margin"
? ? android:paddingLeft="@dimen/activity_horizontal_margin"
? ? android:paddingRight="@dimen/activity_horizontal_margin"
? ? android:paddingTop="@dimen/activity_vertical_margin" ??
? ? android:background="#000000"
? ? android:orientation="vertical" >

? ? ? ? android:layout_width="match_parent"
? ? android:layout_height="100dp" >
? ? ? ? ? ? android:id="@+id/tv1"
? ? ? ? android:layout_width="wrap_content"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:layout_alignParentLeft="true"
? ? ? ? android:layout_alignParentTop="true"
? ? ? ? android:layout_marginTop="14dp"
? ? ? ? android:textSize="20sp"
? ? ? ? android:textColor="#ffffff"
? ? ? ? android:text="About Baiheng"
? ? ? ? ?/>

? ? ? ? ? ? android:id="@+id/tv2"
? ? ? ? android:layout_width="240dp"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:layout_alignParentLeft="true"
? ? ? ? android:layout_below="@+id/tv1"
? ? ? ? android:layout_alignLeft="@id/tv1"
? ? ? ? android:textSize="14sp"
? ? ? ? android:textColor="#88ffffff"
? ? ? ? android:text="Baiheng Software was founded in 2006, specializing in software development companies. detailed ..."
? ? ? ? />

? ? ? ? ? ? android:id="@+id/checkBox1"
? ? ? ? android:layout_width="wrap_content"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:layout_alignParentRight="true"
? ? ? ? android:layout_centerVertical="true" ? ??
? ? ? ? android:layout_marginRight="24dp"
? ? ? ? android:text="" />
? ?
? ? ? ? ? ? ? ? android:layout_below="@id/tv2"
? ? ? ? android:layout_marginTop="10dp"
? ? ? ? android:layout_width="match_parent" ?
? ? ? ? android:layout_height="1dp" ?
? ? ? ? android:background="#88ffffff" ?
? ? ? ? />
? ? ? ?
? ? ? ? ? ? android:layout_width="match_parent"
? ? android:layout_height="80dp" >
? ? ? ? ? ? android:id="@+id/tv1b"
? ? ? ? android:layout_width="wrap_content"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:layout_alignParentLeft="true"
? ? ? ? android:layout_alignParentTop="true"
? ? ? ? android:layout_marginTop="14dp"
? ? ? ? android:textSize="20sp"
? ? ? ? android:textColor="#ffffff"
? ? ? ? android:text="GPS satellites"
? ? ? ? ?/>

? ? ? ? ? ? android:id="@+id/tv2b"
? ? ? ? android:layout_width="260dp"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:layout_alignParentLeft="true"
? ? ? ? android:layout_below="@+id/tv1b"
? ? ? ? android:layout_alignLeft="@id/tv1b"
? ? ? ? android:textSize="14sp"
? ? ? ? android:textColor="#88ffffff"
? ? ? ? android:text="Let apps use GPS to pinpoint your location"
? ? ? ? />

? ? ? ? ? ? android:id="@+id/checkBox1b"
? ? ? ? android:layout_width="wrap_content"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:layout_alignParentRight="true"
? ? ? ? android:layout_centerVertical="true" ? ??
? ? ? ? android:layout_marginRight="24dp"
? ? ? ? android:text="" />
? ?
? ? ? ? ? ? ? ? android:layout_below="@id/tv2"
? ? ? ? android:layout_marginTop="10dp"
? ? ? ? android:layout_width="match_parent" ?
? ? ? ? android:layout_height="1dp" ?
? ? ? ? android:background="#88ffffff" ?
? ? ? ? />


備注:

1.我們在此使用view加了兩條分隔線,可以通過調節(jié)高度來控制線的精細。

2.顏色值最前面兩位數是控制線的透明度,argb.

原創(chuàng)文章出自:百恒網絡 如轉載請注明出處!專業(yè),專注于南昌網站建設、南昌APP開發(fā),為用戶提供高品質的網絡產品及優(yōu)質服務是我們始終的追求.


400-680-9298,0791-88117053
掃一掃關注百恒網絡微信公眾號
掃一掃打開百恒網絡小程序

歡迎您的光顧,我們將竭誠為您服務×

售前咨詢 售前咨詢
 
售前咨詢 售前咨詢
 
售前咨詢 售前咨詢
 
售前咨詢 售前咨詢
 
售前咨詢 售前咨詢
 
售后服務 售后服務
 
售后服務 售后服務
 
備案專線 備案專線
 
×
两当县| 浮山县| 华容县| 泰州市| 武义县| 东山县| 沐川县| 依兰县| 固镇县| 津南区| 北流市| 扎赉特旗| 边坝县| 石城县| 博野县| 西华县| 文安县| 青浦区| 胶南市| 普定县| 大关县| 高青县| 揭西县| 策勒县| 阿克陶县| 梓潼县| 南通市| 股票| 涿鹿县| 玉山县| 都江堰市| 崇阳县| 新余市| 梧州市| 盖州市| 丰原市| 桐庐县| 德格县| 宁蒗| 田东县| 山丹县|