Android studio简单布局之view基本属性
本人属于自学上路,目前是在入门阶段,所以有些内容实质性比较少,请各位大佬多多包涵。
视图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基本属性的更多相关文章
- Android课程---Android Studio简单设置
Android Studio 简单设置 界面设置 默认的 Android Studio 为灰色界面,可以选择使用炫酷的黑色界面.Settings-->Appearance-->Theme, ...
- 【转】Android Studio简单设置
原文网址:http://ask.android-studio.org/?/article/14 Android Studio 简单设置 界面设置 默认的 Android Studio 为灰色界面,可以 ...
- Android Studio简单设置(转)
Android Studio 简单设置 界面设置 默认的 Android Studio 为灰色界面,可以选择使用炫酷的黑色界面.Settings --> Appearance --> Th ...
- 将Android Studio默认布局ConstraintLayout切换成LinearLayout
将Android Studio默认布局ConstraintLayout切换成LinearLayout 大部分人初次使用google android 扁平化布局ConstraintLayout都 ...
- Android studio 基本布局-底部按钮
在使用Android studio 的时候,准备弄的基本的布局出来,底部按钮,按了中间会显示. 来上代码: 页面menu_main.xml 这里弄控件的浮动耗费了点我的时间.原因是因为对其各种问题, ...
- Android Studio 简单介绍和使用问题小结
原文 http://www.cnphp6.com/archives/59264 主题 Gradle Android Studio Android 随着android 5.0 的发布,android ...
- Android Studio 简单功能介绍
Android Studio 建立系统工具包你用来生成,测试,运行您的应用程序和软件包.构建系统是独立于Android的工作室,所以你可以调用它的Android的工作室或从命令行.在你写你的应用程序 ...
- 在eclipse 导入简单的Android studio 简单项目
前言: 现在Android studio版本已经去到2.0(我暂时用着开发者版本)了,但是还是和以前的版本一样卡. (因为我用了很多第三方的UI控件,导致在Android studio build一个 ...
- 设置Android Studio工程布局文件的默认布局
每次创建新的工程后,布局文件的的布局总是ConstraintLayout,如何更改? 进入Android Studio安装目录,用文本编辑器打开文件plugins\android\lib\templa ...
随机推荐
- JSTL varStatus属性
JSTL核心标签库中c:forEach 的 varStatus属性 varStatus属性 类型:String 描述:循环的状态信息,可以取值index\count\first\last\cur ...
- 由于github仓库中提前建立readme文件,导致git push报错error: failed to push some refs to 'git@github.com:
$ git push -u origin master To git@github.com:xxx/xxx.git ! [rejected] master -> master (fetch fi ...
- Oracle-02:SQL语言的分类或者说SQL语言的组成
------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥------------- 小结一版: 01.DDL(Data Definition Language)数据定义语言. 用来创建数据库中 ...
- thymeleaf 专题
Thymeleaf 之 内置对象.定义变量.URL参数及标签自定义属性 如标题所述,这篇文章主要讲述Thymeleaf中的内置对象(list解析.日期格式化.数字格式化等).定义变量.获取URL的参数 ...
- sql server导出数据结构
http://jingyan.baidu.com/article/eae07827ad76ba1fed548573.html
- apply的应用和匿名函数的封装应用
JS中的call()和apply()方法 博客分类: JS 1.方法定义 call方法: 语法:call([thisObj[,arg1[, arg2[, [,.argN]]]]]) 定义:调用 ...
- C++雾中风景9:emplace_back与可变长模板
C++11的版本在vector容器添加了emplace_back方法,相对于原先的push_back方法能够在一定程度上提升vector容器的表现性能.所以我们从STL源码角度来切入,看看这两种方法有 ...
- anguments
anguments是一个对象,长得很像数组的对象,但不是数组,而是伪数组. arguments的内容是函数运行时的实参列表 (function(d, e, f) { console.log(argum ...
- Protostuff序列化分析
前言最近项目中需要将业务对象直接序列化,然后存数据库:考虑到序列化.反序列化的时间以及生产文件的大小觉得Protobuf是一个很好的选择,但是Protobuf有的问题就是需要有一个.proto的描述文 ...
- logger.go
package app //日志接口 type Logger interface { Output(maxdepth int, s string) error }