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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > Android >内容正文

Android

Android 布局练习

發(fā)布時間:2025/3/8 Android 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Android 布局练习 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

要求:使用多種布局完成以下練習(xí)。

1.要求效果 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 完成效果

代碼:

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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" tools:context="com.example.administrator.myapplication.zuoye728_1Activity"><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#beb0b0" android:id="@+id/ll1" ><TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="請登錄" android:textSize="20sp" android:gravity="center" android:layout_marginTop="20dp" android:layout_marginBottom="20dp" /></LinearLayout><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/ll1" android:orientation="vertical" android:id="@+id/ll2" ><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:clickable="true" ><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/xiaoxi" android:background="@drawable/zuoye728_1" android:layout_gravity="center" /><TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text=" 消息平臺" android:textColor="@color/test_bg" android:textSize="30sp" /></LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="#beb0b0" > </View></LinearLayout><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/ll2" android:orientation="vertical" android:id="@+id/ll3" android:clickable="true" ><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" ><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/huodong" android:layout_gravity="center" android:background="@drawable/zuoye728_2" /><TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text=" 校園活動" android:textColor="@color/test_bg" android:textSize="30sp" /></LinearLayout><View android:layout_width="match_parent" android:layout_height="1dp" android:background="#beb0b0" ></View></LinearLayout><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/ll3" android:orientation="vertical" android:id="@+id/ll4" android:clickable="true" ><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" ><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/sixiang" android:layout_gravity="center" /><TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text=" 思想引領(lǐng)" android:textColor="@color/test_bg" android:textSize="30sp" /></LinearLayout><View android:layout_width="match_parent" android:layout_height="1dp" android:background="#beb0b0" ></View></LinearLayout><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/ll4" android:orientation="vertical" android:id="@+id/ll5" android:clickable="true" ><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" ><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/jiuye" android:layout_gravity="center" /><TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text=" 就業(yè)招聘" android:textColor="@color/test_bg" android:textSize="30sp" /></LinearLayout><View android:layout_width="match_parent" android:layout_height="1dp" android:background="#beb0b0" ></View></LinearLayout><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/ll5" android:orientation="vertical" android:id="@+id/ll6" android:clickable="true" ><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" ><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/kaoyan" android:layout_gravity="center" /><TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text=" 考研出國" android:textColor="@color/test_bg" android:textSize="30sp" /></LinearLayout><View android:layout_width="match_parent" android:layout_height="1dp" android:background="#beb0b0" ></View></LinearLayout><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/ll6" android:orientation="vertical" android:id="@+id/ll7" android:clickable="true" ><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" ><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/b" android:layout_gravity="center" /><TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text=" 便利工具" android:textColor="@color/test_bg" android:textSize="30sp" /></LinearLayout></LinearLayout></RelativeLayout> 2.完成下圖三個布局。

作業(yè)1實際效果:


代碼1:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" ><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" android:layout_marginTop="20dp" /><LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" ><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="熱門評論" android:textColor="#ff0000" android:textSize="20sp" android:id="@+id/tv1" /><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="HighSmile山人" android:textSize="20sp" /><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="丹麥治安一直都很好,這種事情估計可以 轟動他們?nèi)珖?/strong>" android:textColor="" /><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="#d1c8c8" ><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="丹麥連發(fā)2起槍擊案致16 尚不清楚是否相關(guān)" android:textColor="" android:layout_gravity="center" /></LinearLayout><LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" ><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="5小時前" android:layout_marginTop="10dp" /><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/dianzan" android:layout_marginTop="10dp" android:layout_marginLeft="90dp" /><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="200" android:layout_marginTop="10dp" /><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/pinglun" android:layout_marginTop="6dp" android:layout_marginLeft="10dp" /><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1" android:layout_marginTop="10dp" /></LinearLayout><TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="查看1條評論" android:textColor="#3a05e9" android:background="#d1c8c8" /></LinearLayout></LinearLayout> </LinearLayout> 作業(yè)2實際效果:


代碼2:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="#f1eaea" ><LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" ><LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" ><LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" ><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:text="春晚五彩:沈騰小品還在" android:textColor="" android:textSize="20sp" /><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="修改" android:textColor="" android:textSize="20sp" /></LinearLayout><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:text="新浪娛樂 評論 220" /></LinearLayout></LinearLayout><ImageView android:layout_width="100dp" android:layout_height="100dp" android:src="@mipmap/ic_launcher" android:layout_marginLeft="40dp" /></LinearLayout> </LinearLayout> 作業(yè)3實際效果:

總結(jié)

以上是生活随笔為你收集整理的Android 布局练习的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。