<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity"> <LinearLayout
android:id="@+id/ll_1"
android:layout_width="200dp"
android:layout_height="200dp"
android:background="#000000"
android:orientation="vertical"
android:padding="20dp"> <View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#a42525" /> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:orientation="horizontal"
android:background="#0066FF"
android:layout_marginTop="20dp"
android:gravity="center_vertical">
<View
android:layout_width="0dp"
android:layout_height="200dp"
android:background="#000000"
android:layout_weight="1"
/>
<View
android:layout_width="0dp"
android:layout_height="200dp"
android:background="#ef0000"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>

今天学习到的:

  

<LinearLayout  +代码
> </LinearLayout>水平布局
android:layout_width="?dp"宽度
android:layout_height="?dp"高度
android:background="#ef0000"背景颜色
android:layout_weight="1"块所占的权重
android:gravity="center_vertical">对齐方式
android:orientation="vertical"排列方式 水平/竖直
结果:

												

Android Studio [水平布局LinearLayout]的更多相关文章

  1. 将Android Studio默认布局ConstraintLayout切换成LinearLayout

    将Android Studio默认布局ConstraintLayout切换成LinearLayout     大部分人初次使用google android 扁平化布局ConstraintLayout都 ...

  2. Android studio 基本布局-底部按钮

    在使用Android studio 的时候,准备弄的基本的布局出来,底部按钮,按了中间会显示. 来上代码: 页面menu_main.xml 这里弄控件的浮动耗费了点我的时间.原因是因为对其各种问题, ...

  3. 设置Android Studio工程布局文件的默认布局

    每次创建新的工程后,布局文件的的布局总是ConstraintLayout,如何更改? 进入Android Studio安装目录,用文本编辑器打开文件plugins\android\lib\templa ...

  4. Android studio简单布局之view基本属性

    本人属于自学上路,目前是在入门阶段,所以有些内容实质性比较少,请各位大佬多多包涵. 视图view的基本属性: layout_margin:定义视图与周围视图之间的空白距离 layout_padding ...

  5. Android Studio [相对布局RelativeLayout]

    <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android=&q ...

  6. Android 使用线性布局LinearLayout和Button实现一个点红块游戏

    这个游戏的功能类似打地鼠. 项目地址:https://github.com/moonlightpoet/RedBlock 程序下载试玩地址:https://github.com/moonlightpo ...

  7. Android studio中布局文件出现render problem问题

    当做layout时,可能会出现render problem的情况.意思就是无法预览当前布局页面,这种情况是因为API版本太高造成的.只需要修改API为更低版本即可.

  8. 无废话Android之常见adb指令、电话拨号器、点击事件的4种写法、短信发送器、Android 中各种布局(1)

    1.Android是什么 手机设备的软件栈,包括一个完整的操作系统.中间件.关键的应用程序,底层是linux内核,安全管理.内存管理.进程管理.电源管理.硬件驱动 2.Dalvik VM 和 JVM ...

  9. [置顶] Android系统五大布局详解Layout

    我们知道Android系统应用程序一般是由多个Activity组成,而这些Activity以视图的形式展现在我们面前,视图都是由一个一个的组件构成的.组件就是我们常见的Button.TextEdit等 ...

随机推荐

  1. <lable>标签

    最近用各种框架的时候,发现很多平常自己写代码没注意到的标签和用法,在这里记录一下. 其实是很多细节方面需要注意的写法. <label> 定义:为input元素定义标注 label标签不会向 ...

  2. 一文搞懂Python中的所有数组数据类型

    关于我 一个有思想的程序猿,终身学习实践者,目前在一个创业团队任team lead,技术栈涉及Android.Python.Java和Go,这个也是我们团队的主要技术栈. Github:https:/ ...

  3. 百度地图获取定位,实现拖动marker定位,返回具体的位置名

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  4. 非域环境下SQL Server搭建Mirror(镜像)的详细步骤

    1.测试验证环境 服务器角色 机器名 IP SQL Server Ver 主体服务器 WIN-TestDB4O 172.83.XXX.XXX SQL Server 2012 - 11.0.5058.0 ...

  5. Codeforces 1004E

    题意略. 思路: 这k个点应该放在这棵树的直径上,并且能连成一条路径.如果k比树的直径上的点要多,那么我们就不用把这k个点都用上, 只需要把这棵树直径上所有的点都覆盖上就行了.如果k比树的直径上的点要 ...

  6. Storm 系列(五)—— Storm 编程模型详解

    一.简介 下图为 Strom 的运行流程图,在开发 Storm 流处理程序时,我们需要采用内置或自定义实现 spout(数据源) 和 bolt(处理单元),并通过 TopologyBuilder 将它 ...

  7. P1640 [SCOI2010]连续攻击游戏 二分图构造

    https://www.luogu.org/problemnew/show/P1640 题意 lxhgww最近迷上了一款游戏,在游戏里,他拥有很多的装备,每种装备都有2个属性,这些属性的值用[1,10 ...

  8. ZOJ-3964 Yet Another Game of Stones

    Yet Another Game of Stones 题意: Alice 和 Bob 在进行取石子游戏, 现在一共有n堆石子, 每堆石头有ai个, 然后每堆石头有一个bi属性, 如果bi == 0, ...

  9. POJ-2236 Wireless Network 顺便讨论时间超限问题

    Wireless Network Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 26131   Accepted: 108 ...

  10. icpc 江苏 D Persona5 组合数学 大数阶乘(分段阶乘) 大数阶乘模板

    Persona5 is a famous video game. In the game, you are going to build relationship with your friends. ...