Android 布局练习

简介: 要求:使用多种布局完成以下练习。 1.要求效果                                                                                                             完成效果 代码: <?xml version="1.0" encoding="utf-8"?>&lt

要求:使用多种布局完成以下练习。

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="  思想引领"
                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="  就业招聘"
                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.完成下图三个布局。

作业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="丹麦治安一直都很好,这种事情估计可以
                轰动他们全国了"
                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="丹麦连发2起枪击案致1死6伤
                    尚不清楚是否相关"
                    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>
作业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>
作业3实际效果:

目录
相关文章
|
监控 Linux 数据安全/隐私保护
IPMI介绍
IPMI简要介绍
8544 0
|
29天前
|
人工智能 开发者 计算机视觉
19岁收银员用AI做App,10万下载零代码摔跤教练
19岁超市收银员,零代码起步,靠AI打造10万下载摔跤教练App,累计收入144万元。本案例拆解“普通人做AI产品的三步法”:扎根冷门圈子找真痛点、聚焦“5秒看懂”的核心功能、用私信+博主合作精准分发。不是天才神话,而是可复制的认知与执行范式。(239字)
|
2月前
|
人工智能 JSON 物联网
AI 漫剧动态视频工业化生产:分镜渲染、图生视频与批量自动化落地实战
本文系统解析AI漫剧生产核心痛点(角色漂移、动态失控、帧闪、长镜崩坏、文件混乱),提出“短镜头+微动态”最优实践,并详解五阶段流水线、ComfyUI动态化方案(AnimateDiff/LTX-Video参数逻辑)、Python批量生成脚本及网盘协同管理策略,助力高效稳定出片。(239字)
594 0
|
3月前
|
数据采集 JSON 数据挖掘
Temperature 原理详解:大模型随机性参数与场景设置
Temperature 是调节大模型输出随机性的生成参数。它影响模型按概率分布预测下一个词,了解代码生成温度设置和数据抽取取值示例,有助于按任务平衡稳定性与变化空间。
673 0
|
5月前
|
数据可视化
Tushare接口文档:财务指标数据(fina_indicator)
本文旨在对Tushare的财务指标数据`fina_indicator`数据接口进行介绍,提供更多参考示例和使用说明。 财务指标数据包括盈利能力(如“净资产收益率”、“销售净利率”)、成长能力(如“营业收入同比增长率”)、偿债能力(如“资产负债率”、“流动比率”)、运营能力和现金流量等指标。本文除了介绍如何获取某支股票的财务数据外还介绍了通过VIP版本(`fina_indicator_vip`)一次性获取某个报告期内的所有股票财务指标。要注意传递`fields`以便能够获取想要的字段,还要注意`update_flag`对修正数据的标识。
742 2
|
5月前
|
编解码 运维 算法
iOS云手机H.264与H.265编解码技术对比 2026远程低延迟传输选型科普
云手机流畅度关键在视频编码!H.264兼容广但耗流高、延迟大;H.265硬编码码率降50%、延迟≤30ms,苹果原生优化,省流又跟手。2026年中高端云手机已全面转向H.265,iOS用户务必认准硬件编码方案。(239字)
|
5月前
|
API 数据安全/隐私保护
快递取件码-取件码-获取取件码API接口介绍
本API提供快递入驿站后的取件码实时通知服务,支持订阅、查询、推送三大功能。用户通过运单号+快递编码发起订阅(须在入站前完成),可选回调推送或主动查询取件码,适用于购物APP、公众号等需收货提醒的场景。
1013 0
|
6月前
|
弹性计算 人工智能 安全
阿里云服务器镜像解析:公共、自定义、共享、社区镜像等区别与选择参考
本文介绍了阿里云ECS服务器镜像的概念、类型与选择策略。镜像是ECS实例的"装机盘",包含操作系统及预装软件,可快速创建相同环境的服务器。阿里云提供公共、自定义、共享、云市场、社区五大镜像类型,分别适用于通用场景、环境复制、团队协作、一键部署及技术实验。选择时应遵循"求稳选公共、复制用自定义、协作靠共享、求快找市场、实验尝社区"的原则,同时需关注成本、合规及地域限制。
|
8月前
|
数据采集 存储 自然语言处理
大模型应用:中文大模型本土化效果评估方案:体系化方法、评估指标.81
本文提出中文大模型本土化评估体系,聚焦“中文理解、文化适配、场景落地、合规对齐”四大维度,构建分层(基础语言→文化深度→场景应用→合规底线)、可量化、重实效的评估框架,强调本土语料、人工与自动结合、一票否决等原则,助力模型真正扎根中文场景。
473 6