android基础知识复习——RelativeLayout布局属性、背景、半透明设置(XML设置)
转自:http://blog.csdn.net/fansongy/article/details/6817968
复习布局与XML,写了一个空的登录界面。XML的注释我写在当行的后面了。程序运行图:
主函数没有改动,不贴了。背景图片名为:background.jpg 。看看main.xml吧。
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="@drawable/background" //设置背景
- >
- <LinearLayout android:id="@+id/empty" //占位用的layout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight ="1"></LinearLayout> //设置占总权重的比例
- <RelativeLayout android:id="@+id/relativeLayout"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="2"
- android:padding="10px"> //设置内间距
- /*颜色和不透明度 (alpha) 值以十六进制表示法表示。任何一种颜色的值范围都是 0 到 255(00 到 ff)。对于 alpha,00 表示完全透明,ff 表示完全不透明。表达式顺序是“aabbggrr”,其中“aa=alpha”(00 到 ff);“bb=blue”(00 到 ff);“gg=green”(00 到 ff);“rr=red”(00 到 ff)。例如,如果您希望对某叠加层应用不透明度为 50% 的蓝色,则应指定以下值:7fff0000 */
- <TextView
- android:id="@+id/user"
- android:text="用户名: "
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:textColor="#ffffffff" />
- <EditText android:id="@+id/username"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/user" //在id为user的控件之下
- android:background="#88ffffff"/> //设置不透明
- <TextView
- android:id="@+id/key"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="密码:"
- android:layout_below="@id/username"
- android:textColor="#ffffffff" />
- <EditText android:id="@+id/keyword"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/key"
- android:background="#88ffffff"
- android:password="true"/>
- <CheckBox android:id="@+id/remember"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:text="记住密码"
- android:layout_below="@id/keyword"
- android:layout_alignLeft="@id/keyword"
- android:layout_marginLeft="15px"/> //外间距
- <CheckBox android:id="@+id/autoin"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:text="自动登录"
- android:layout_below="@id/keyword"
- android:layout_alignRight="@id/keyword" //与id为keyword的控件右对齐
- android:layout_marginRight="15px"/>
- <Button android:id="@+id/enter"
- android:layout_height="wrap_content"
- android:layout_width="fill_parent"
- android:gravity="center_horizontal" //内部文字位置
- android:text="登 录"
- android:layout_below="@id/autoin"
- android:layout_margin="10px"/>
- </RelativeLayout>
- </LinearLayout>
本篇博客出自 阿修罗道,转载请注明出处:http://blog.csdn.net/fansongy/article/details/6817968
android基础知识复习——RelativeLayout布局属性、背景、半透明设置(XML设置)的更多相关文章
- Android基础知识复习之打开照相机拍照并获取照片
对于我来说,做一件事情: 首先要理清我的思路,我要打开照相机,我能想到的是:在Android中我要打开系统应用,肯定需要一个隐式意图,那就要查询Android照相机的源码,查看并找到意图过滤器的书写方 ...
- 【Xamarin开发 Android 系列 4】 Android 基础知识
原文:[Xamarin开发 Android 系列 4] Android 基础知识 什么是Android? Android一词的本义指“机器人”,同时也是Google于2007年11月5日宣布的基于Li ...
- android:layout_alignleft layout_toleftof区别,详解RelativeLayout布局属性
转载请注明博客地址. 最近看博客看到有关于RelativeLayout布局的解释,有的解释很多是错误的.因此有必要对每一个常见的布局属性进行描述.以下解释全部都是逐行进行测试的. 首先把常用的布局分组 ...
- WPF基础知识、界面布局及控件Binding(转)
WPF是和WinForm对应的,而其核心是数据驱动事件,在开发中显示的是UI界面和逻辑关系相分离的一种开放语言.UI界面是在XAML语言环境下开发人员可以进行一些自主设计的前台界面,逻辑关系还是基于c ...
- WPF基础知识、界面布局及控件Binding
WPF是和WinForm对应的,而其核心是数据驱动事件,在开发中显示的是UI界面和逻辑关系相分离的一种开放语言.UI界面是在XAML语言环境下开发人员可以进行一些自主设计的前台界面,逻辑关系还是基于c ...
- Android基础_3 Activity相对布局
相对布局要比前面讲的线性布局和表格布局要灵活一些,所以平常用得也是比较多的.相对布局控件的位置是与其周围控件的位置相关的,从名字可以看出来,这些位置都是相对的,确定出了其中一个控件的位置就可以确定另一 ...
- Android 如何把一个 RelativeLayout或ImageView背景设为透明
在项目中,需要把RelativeLayout 和 ImageView背景设置为透明,怎么实现呢?这里主要通过代码,请参阅以下关键代码: public ImageView imgDetail; pri ...
- Android基础知识巩固:关于PendingIntent和广播
平时使用广播的场合比较多,但细节的东西,看过了也没有总结,以至于某些场合有小问题,还是要把原理和属性搞清楚才能运用自如. 其实也是自己比较懒,先看别人的blog,有个概念再去官网看英文的能好理解一些. ...
- Android基础知识-1
1.Android的Activity任务栈 在Android的系统中,在APP运行时每个APP都会默认有一个任务栈,任务栈的名称以APP的包名命名.任务栈是一中先进后出的结构,APP中每一个调用的Ac ...
随机推荐
- Hive 体系学习
Hive简介 Hive是一个基于Hadoop的数据仓库工具,可以将结构化的数据文件映射为一张数据库表,并使用HQL作为查询接口.HDFS作为存储底层.MapReduce作为执行层,将HQL语句转换成M ...
- 《java并发编程实战》读书笔记5--任务执行, Executor框架
第6章 任务执行 6.1 在线程中执行任务 第一步要找出清晰的任务边界.大多数服务器应用程序都提供了一种自然的任务边界选择方式:以独立的请求为边界. -6.6.1 串行地执行任务 最简单的任务调度策略 ...
- [转载]Python命令行参数学习
转载自: http://blog.163.com/weak_time/blog/static/25852809120169333247925/ Python的命令行参数,提供了很多有用的功能,可以方便 ...
- SEO编辑必看:撰写搜索引擎喜爱的标题
导读:非常有干货,百度站长平台刚发布了这篇篇文章,文章建议:1,标题字数控制在65个字节内,2,重要内容放在标题的最前面,3,添加与网页内容最相关的.用户更常用的.满足用户明确需求的.体现时效性.关键 ...
- zoj 4020 The 18th Zhejiang University Programming Contest Sponsored by TuSimple - G Traffic Light(广搜)
题目链接:The 18th Zhejiang University Programming Contest Sponsored by TuSimple - G Traffic Light 题解: 题意 ...
- Exception异常处理机制
为什么要自定义自己的Exception ,Java Exception机制与传统的C语言的异常处理机制有什么不同,这种Exception机制的意义在什么地方?接下来咱就来和你一起探讨Exception ...
- javascript获取dom的下一个节点方法
需求说明: 获取当前节点左节点或者右节点(兄弟节点): css: <style type="text/css"> a:focus { outline: none; } ...
- django-BBS(1)
1.首先分析BBS的设计需要,然后设计相应的数据库.填写在models.py 中 2.修改setting.py中的内容: a.将appname加入INSTALLED_APP中 b.修改DATABASE ...
- AndroidManifest.xml文件详解(permission)
http://blog.csdn.net/think_soft/article/details/7574726 语法(SYNTAX): <permissionandroid:descriptio ...
- org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 32; 元素类型为 "key" 的内容必须匹配 "(column)*"
报错:部分错误信息,主要查看CauseBy Caused by: org.hibernate.InvalidMappingException: Unable to read XML at org.hi ...