Android 布局练习

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

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起枪击案致16                    尚不清楚是否相关"
                    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实际效果:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/542819.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

有危害吗_涂料漆对身体有害吗?涂料漆危害怎么预防

目前很多人都会通过涂料漆来进行墙面装饰&#xff0c;用它来对墙面进行装饰是可以马上的改善墙壁的状态&#xff0c;但有些人也担心它会对身体有害&#xff0c;涂料漆对身体有害吗?由于担心涂料漆会给健康带来危害&#xff0c;很多人都想要预防&#xff0c;那涂料漆危害怎么预…

小写大写转换_小写到大写转换器JavaScript工具| 网络应用项目

小写大写转换Hi! At times, beginners always find it hard getting the application of the theory they learn in programming or a particular language. 嗨&#xff01; 有时&#xff0c;初学者总是很​​难在编程或特定语言中应用他们学到的理论。 In this article, well…

inventor扳手制作视频_弱电工程视频监控系统施工方案,可作施工组织设计

1 工程概况 1.1 编制《工程总体实施方案》 主要包括&#xff1a;结合高清监控系统设计方案作配套的深化设计&#xff0c;编制高清监控系统实施计划&#xff0c;并提出相关的配合要求。根据总体方案&#xff0c;对高清监控系统工程的技术设计作必要的补充。并提出相关的实施技术…

python print与input

python基础语法1print()函数input()函数print()函数 不用引号&#xff0c;函数内为数字或数字运算 单引号&#xff0c;整条语句结构&#xff0c;’\n’ 双引号&#xff0c;函数结构 三引号&#xff0c;对内容进行换行输出 print("let is go")#函数结构 print(let i…

lol最克制诺手的英雄_LOL:究竟有没有完美克制诺手的英雄?时光上单或可一战?...

小伙伴们大家好&#xff0c;我是小数点。诺克萨斯之手德莱厄斯&#xff0c;他可以说是每一位上单玩家的噩梦了&#xff0c;因为喜欢玩诺手的人特别多&#xff0c;而会玩的诺手却一般都在对面。要知道诺手这样英雄拿到优势凶起来&#xff0c;你就没得打了&#xff0c;就算在塔下…

Oracle 创建表空间,用户,赋值(简装)

一&#xff0c;1.Oracle 创建表空间&#xff0c;用户&#xff0c;赋值&#xff08;简装&#xff09;C:\Documents and Settings\Administrator>sqlplus /nologSQL> conn /as sysdba2.删除用户drop user username cascade;3.创建自增表表空间SQL> create tablespace 表…

编程语言难度排名_编程语言TOP10!该如何选择适合自己的?

本文转载自公众号“读芯术”(ID&#xff1a;AI_Discovery)编程领域大约有700种代码语言。理解编程语言的重要性以及其如何影响需要执行的具体任务至关重要。一篇文章穷尽700 种语言不现实&#xff0c;也没有意义。因此&#xff0c;笔者挑选出了时下最热门的原因&#xff0c;在本…

测试私有方法 重构_一个全栈工程师重构之路:中小公司 DevOps 落地实践

为了这篇文章&#xff0c;我前后写了将近十篇文章铺垫&#xff0c;才将这篇整体重构思想引出。背景先说下背景&#xff0c;我们是一家小公司&#xff0c;虽然打着做产品的旗帜&#xff0c;但是每个客户都有大量的个性化功能&#xff0c;这里指各个客户的java端、Android端、ios…

python变量 数据类型 列表 元组 字典

python基础语法2变量数据类型与类型转换列表添加列表元素修改元素删除列表元素组织列表创建数值列表操作列表元组元组转列表字典创建字典列表取值字典删除增加修改变量 变量命名要求&#xff1a; 1.只能是一个词 2.只能包含字母、数字、下划线 3.不能用数字开头 变量定义位置不…

HDU 5777 domino

贪心一下。有k次机会&#xff0c;也就是那些数字中&#xff0c;最大的k-1可以不选择。答案为&#xff1a;sum{a[i]}-sum{最大的k-1个a[i]}n。注意&#xff1a;k>n的时候直接输出n。 #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio&…

puppeteer执行js_使用Node.js和Puppeteer与表单和网页进行交互– 2

puppeteer执行jsHi guys! Today lets look at another powerful function of the puppeteer API using Node.js part 2. 嗨&#xff0c;大家好&#xff01; 今天&#xff0c;让我们看看使用Node.js第2部分的puppeteer API的另一个强大功能。 In the first part of this sectio…

好用的平板电脑_小熊分享|这五款平板电脑的性价比绝了!

【叶紫网】独乐乐不如众乐乐&#xff0c;点击上方头像并添加关注&#xff0c;与叶紫科技小熊一起探索科技的奥秘。要说当代年轻人的消费观&#xff0c;我们也是说要该花花&#xff0c;该省省&#xff0c;像现在的科技产品更新换代的速度&#xff0c;就算我们的荷包相当的鼓&…

python if语句 for语句 while语句

python基础语法3if语句for循环while循环else语句退出循环if语句 执行条件判断&#xff0c;符合执行if内语句&#xff0c;否则执行elif或者else。 if、elif、else都要接冒号&#xff0c;注意缩进 各级条件互斥 后面的条件可以接列表&#xff0c;表示或关系 contribution860 if…

交际过程的两个基本环节_跨文化交际学概论笔记(二)

第二部分 基本概念&#xff1a;文化与交际第一章 文化的定义与特征一、文化的定义1. 文化的定义为何重要首先&#xff0c;在跨文化交际学中文化是一个至关重要的问题。研究时&#xff0c;不可避免进行文化对比。其次&#xff0c;在研究任何学科前&#xff0c;术语的界定是前提。…

Python中列表的del,remove和pop函数之间的区别

1)Python del函数 (1) Python del function) del is nothing but "delete". del is a keyword which basically goes on the position given by the user in del(position) and deletes that element and also changes the positions of all the other elements as i…

lcd图片转二进制工具_辽宁2.8寸LCD屏价格,测距仪LCD显示屏_思迈微

首页 > 新闻中心发布时间&#xff1a;2020-11-15 08:27:09 导读&#xff1a;思迈微为您提供辽宁寸LCD屏价格,测距仪LCD显示屏的相关知识与详情&#xff1a; 以上便是对LED点阵式显示屏的软硬件系统、组成等的技术知识的粗略的介绍。以这款名为《液晶显示器亮点坏点修复工具》…

python 布尔值 布尔运算 运算符

python基础语法4布尔值布尔运算运算符算术运算符赋值运算符比较运算符逻辑运算符布尔值 布尔值&#xff1a;Ture&#xff08;真&#xff09; Flase&#xff08;假&#xff09; 假&#xff1a;Flase、0、’’&#xff08;空字符串&#xff09;、[]&#xff08;空列表&#xff0…

python代码安全性问题_这个python代码对注入安全吗?

我在Python中有一个服务器/客户机套接字对。服务器接收特定的命令&#xff0c;然后准备响应并将其发送到客户端。在在这个问题中&#xff0c;我关心的只是代码中的可能的注入&#xff1a;如果可以要求服务器对第二个参数做一些奇怪的事情——如果对命令内容的控制不足以避免不希…

Python | 使用+ =运算符在字符串末尾附加文本

Given a string, and we have to append more string (text) at the end of the string using operator in Python. 给定一个字符串&#xff0c;我们必须在Python中使用 运算符在字符串的末尾附加更多字符串(文本)。 There are two methods to add string (text) at the end …

ps如何修改图片大小尺寸_PS新手入门教程:学习如何修改画布的大小

PS新手入门教程&#xff1a;学习如何修改画布的大小。在photoshop中&#xff0c;可以把画布理解为一张白纸&#xff0c;而我们要处理的图像可以理解为这张白纸表面上的画。我们修改画布的大小时&#xff0c;图像并不会随着画布的大小而整体变大或缩小&#xff0c;这是修改画布大…