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

视图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. 小黄鸡机器人和小I机器人的调用

    <?php    //---------------------------------聊天小机器人类---------------------------------------------- ...

  2. Ubuntu 18.04 on Windows 10 更改 Oh-My-Zsh agnoster 主题下的目录背景色

    题外话 我的 MacBook Pro 已经使用了6年多的时间,尽管作为一个 .NET 程序员绝大部分时间都是在 Windows 下工作,直到 .NET Core 的逐步成熟.要说 Mac OS,最满意 ...

  3. 背景图片蒙上一层颜色(背景图片无法用rgba调整透明度!)

    方法就是在图片上面加一层DIV,将DIV的背景颜色调成rgba(0,0,0,0.3);即可

  4. ViewDragHelper实战 自己打造Drawerlayout

    转载请标明出处: http://blog.csdn.net/lmj623565791/article/details/47396187: 本文出自:[张鸿洋的博客] 一.概述 中间拖了蛮长时间了,在上 ...

  5. Golang Multipart File Upload Example

    http://matt.aimonetti.net/posts/2013/07/01/golang-multipart-file-upload-example/ The Go language is ...

  6. junit+mock+spring-test构建后台单元测试

    from:从0开始,构建前后端分离应用 1. 一些基本概念 1.1 为什么要进行单元测试?我自己的理解是 1.能够快速发现问题.避免衍生BUG的出现     在对一些现有代码进行修改时,或者修改现有B ...

  7. centos7 更新Firefox版本

    1.用你本地的旧版 firefox,访问http://www.firefox.com.cn,下载Linux版本的Firefox,因为我的是64位故选择的安装包是:"Firefox-lates ...

  8. CopyOnWriteArrayList简介

    CopyOnWriteArrayList,写数组的拷贝,支持高效率并发且是线程安全的,读操作无锁的ArrayList.所有可变操作都是通过对底层数组进行一次新的复制来实现. CopyOnWriteAr ...

  9. C++中memset()函数的作用

    memset()函数可以对大内存的分配进行很方便的操作(初始化),所谓“初始化”,当然是指将你定义的变量或申请的空间赋予你所期望的值, 例如语句int i=0;就表明定义了一个变量i,并初始化为0: ...

  10. Heartbeat实现集群高可用热备

    公司最近需要针对服务器实现热可用热备,这几天也一直在琢磨这个方面的东西,今天做了一些Heartbeat方面的工作,在此记录下来,给需要的人以参考. Heartbeat 项目是 Linux-HA 工程的 ...