本人属于自学上路,目前是在入门阶段,所以有些内容实质性比较少,请各位大佬多多包涵。

视图view的基本属性:

layout_margin:定义视图与周围视图之间的空白距离

layout_padding:是指当前视图与内部内容的距离

线性布局LinearLayout

  layout_gravity:指定该视图与上级视图的对齐方式

  gravity:指定布局内容视图与本视图的对齐方式

附上实例代码与运行结果:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="#ffff99"
android:orientation="horizontal"
android:padding="0dp"> <LinearLayout
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_weight="1"
android:layout_gravity="bottom"
android:gravity="left"
android:background="#ff0000"
android:layout_margin="20dp"
android:padding="20dp"
android:orientation="vertical"
> <View
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#0000ff"/> </LinearLayout> <LinearLayout
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_weight="1"
android:layout_gravity="top"
android:gravity="right"
android:background="#ff0000"
android:layout_margin="10dp"
android:padding="10dp"
android:orientation="vertical"
> <View
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#0000ff"/> </LinearLayout>
</LinearLayout>

Android studio简单布局之view基本属性的更多相关文章

  1. Android课程---Android Studio简单设置

    Android Studio 简单设置 界面设置 默认的 Android Studio 为灰色界面,可以选择使用炫酷的黑色界面.Settings-->Appearance-->Theme, ...

  2. 【转】Android Studio简单设置

    原文网址:http://ask.android-studio.org/?/article/14 Android Studio 简单设置 界面设置 默认的 Android Studio 为灰色界面,可以 ...

  3. Android Studio简单设置(转)

    Android Studio 简单设置 界面设置 默认的 Android Studio 为灰色界面,可以选择使用炫酷的黑色界面.Settings --> Appearance --> Th ...

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

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

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

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

  6. Android Studio 简单介绍和使用问题小结

    原文  http://www.cnphp6.com/archives/59264 主题 Gradle Android Studio Android 随着android 5.0 的发布,android ...

  7. Android Studio 简单功能介绍

    Android Studio  建立系统工具包你用来生成,测试,运行您的应用程序和软件包.构建系统是独立于Android的工作室,所以你可以调用它的Android的工作室或从命令行.在你写你的应用程序 ...

  8. 在eclipse 导入简单的Android studio 简单项目

    前言: 现在Android studio版本已经去到2.0(我暂时用着开发者版本)了,但是还是和以前的版本一样卡. (因为我用了很多第三方的UI控件,导致在Android studio build一个 ...

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

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

随机推荐

  1. Python《学习手册:第二章-习题》

    什么是Python解释器? Python解释器是运行Python程序的程序. 什么是源代码? 源代码是为程序所写的语句:它包括文本文件(通常以.py为文件名结尾)的文件. 什么是字节码? 字节码是Py ...

  2. Linux下MySQL的数据文件存放位置

    http://bbs.csdn.net/topics/390620630mysql> show variables like '%dir%';+------------------------- ...

  3. strace详解及实战

    详细参数: -c 统计每一系统调用的所执行的时间,次数和出错的次数等. -d 输出strace关于标准错误的调试信息. -f 跟踪由fork调用所产生的子进程. -ff 如果提供-o filename ...

  4. Thread部分总结以及小例子

    Thread总结:一直以来用thread比较多,一般会在同步以及ui中用到.以下对于经常用作为简单介绍.一 实现方法: 一种直接new thread,另外一种是实现Runnable接口,在创建thre ...

  5. xml序列化和反序列化(一)

    最近项目中需要调用第三方webservice,入参和出参采用xml格式,大致如下: 入参: <?xml version="1.0" encoding="utf-8& ...

  6. ARP协议与ARP攻击入门

    一 ARP协议 ARP协议是一个年代相当"久远"的网络协议.ARP协议制定于1982年11月,英文全称:Address Resolution Protocol,即"地址解 ...

  7. IE8中marquee不显示出滚动效果的解决办法

    随着各种软件的升级,我们系统中的IE6也渐渐被淘汰了,目前主流的浏览器一半的用户已经从IE6直接升级到了IE8,虽然给用户更好的体验,上网更快更方便了,但是对网站制作来说,又是个比较麻烦的问题,因为很 ...

  8. python中RabbitMQ的使用(安装和简单教程)

    1,简介 RabbitMQ是一个由erlang开发的AMQP(Advanced Message Queue )的开源实现的产品,RabbitMQ是一个消息代理,从"生产者"接收消息 ...

  9. git fatal: 远程 origin 已经存在。

    不小心将git远程地址配错了,再次配置提示以下错误: fatal: 远程 origin 已经存在. 此时只需要将远程配置删除,重新添加即可: git remote rm origin git remo ...

  10. 去除vue项目中的#及其ie9兼容性

    一.如何去除vue项目中访问地址的# vue2中在路由配置中添加mode(vue-cli创建的项目在src/router/index.js) export default new Router({ m ...