android基础知识复习(二)——RelativeLayout布局属性、背景、半透明设置(XML设置)
2011-09-24 19:34
806 查看
复习布局与XML,写了一个空的登录界面。XML的注释我写在当行的后面了。程序运行图:
主函数没有改动,不贴了。背景图片名为:background.jpg 。看看main.xml吧。
本篇博客出自 阿修罗道,转载请注明出处:/article/1505702.html
主函数没有改动,不贴了。背景图片名为: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>
本篇博客出自 阿修罗道,转载请注明出处:/article/1505702.html
相关文章推荐
- android基础知识复习——RelativeLayout布局属性、背景、半透明设置(XML设置)
- android基础-view的属性(XML通用属性和方法)和布局管理器(常用布局)
- Android基础之LinearLayout与RelativeLayout的布局属性
- Android屏幕的灰色透明背景蒙版的简单控制,不需要设置xml属性
- android布局设置Button或者ImageButton的背景透明 半透明 透明
- Android基础教程之五大布局对象------FrameLayout,LinearLayout,AbsoluteLayout,RelativeLayout,TableLayout
- Android布局-RelativeLayout属性详解
- TextView的XML属性说明全析 ---Android基础篇
- Android基础入门教程——2.2.2 RelativeLayout(相对布局)
- android textview xml 属性设置
- Android开发中XML布局的常用属性说明
- android textview xml 属性设置
- 通过在xml布局文件中设置android:onClick=""来实现组件单击事件
- Android 布局自定义Shap圆形ImageView,可以单独设置背景与图片
- android XML布局 属性与运用
- android xml界面布局常用属性概括
- 【android基础】之Android设置背景透明
- Android动态布局,并动态为TextView控件设置drawableLeft、drawableRight等属性添加图标
- android:布局参数,控件属性及各种xml的作用