android 布局随笔
来源:互联网 发布:淘宝上的epiphone 编辑:程序博客网 时间:2024/06/04 18:53
先看一下登录界面。
本文章就是给初学者一个例子。
本例子使用RelativeLayout布局标签
现在上代码
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 android:layout_width="fill_parent" 4 android:layout_height="fill_parent" 5 android:orientation="vertical" 6 android:padding="10px"> 7 8 <TextView android:layout_width="wrap_content" 9 android:layout_height="wrap_content"10 android:id="@+id/tx_username"11 android:text="@string/tx_username"/>12 13 <EditText android:layout_width="fill_parent"14 android:layout_height="wrap_content"15 android:background="@android:drawable/editbox_background"16 android:layout_below="@id/tx_username"17 android:id="@+id/UserName"/>18 19 <TextView android:layout_width="wrap_content"20 android:layout_height="wrap_content"21 android:layout_below="@id/UserName"22 android:id="@+id/tx_password"23 android:text="@string/tx_password"/>24 25 <EditText android:layout_width="fill_parent"26 android:layout_height="wrap_content"27 android:inputType="textWebPassword"28 android:background="@android:drawable/editbox_background"29 android:layout_below="@id/tx_password"30 android:id="@+id/PassWord"/>31 32 <CheckBox33 android:id="@+id/Remember_PassWord"34 android:layout_width="wrap_content"35 android:layout_height="wrap_content"36 android:layout_alignParentLeft="true"37 android:layout_below="@id/PassWord"38 android:text="@string/tx_remember_password" />39 40 <Button41 android:id="@+id/Login"42 android:layout_width="wrap_content"43 android:layout_height="wrap_content"44 android:layout_gravity="center_horizontal"45 android:layout_below="@id/PassWord"46 android:layout_alignParentRight="true"47 android:text="@string/tx_login" />48 49 </RelativeLayout>
大概说一下,首先RelativeLayout是相对布局,其中的每个空间都用到了相对布局的标签
1、android:layout_below="@id/tx_username" 意思是:这个控件的顶部,在id为tx_username的下面;
2、android:layout_alignParentLeft="true" 意思是:这个控件,紧贴父控件的右侧;
3、android:padding="10px" 意思是:内边距为10px;
<script type="text/javascript"><!--google_ad_client = "ca-pub-1944176156128447";/* cnblogs 首页横幅 */google_ad_slot = "5419468456";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- android 布局随笔
- Android开发随笔 TableLayout布局
- Android随笔之动态加载布局
- Android随笔之布局属性简单用法
- 布局随笔
- 随笔:android的一个布局点击覆盖问题
- android 项目学习随笔九(ListView加头布局)
- android 项目学习随笔十二(ListView加脚布局)
- Android 随笔
- Android随笔
- android随笔
- Android随笔
- Android 随笔
- android随笔
- Android随笔
- android随笔
- Android随笔
- Android随笔
- Unity 3D--获取ios平台下路径
- 请求发送者与接收者解耦——命令模式(二)
- widget layout设计(设置minWidth和minHeight),保证最小,剩下由系统来拉伸(成若干格)
- 海量数据处理:十道面试题与十个海量数据处理方法总结
- 函数调用下形参和实参的内存分配
- android 布局随笔
- 低功耗设计中电容对系统的影响(二)
- java八种排序
- scanf的陷阱
- static数据成员 c++
- 有关针式打印机和一体机的安装
- 概率算法 -- 洗牌
- oracle游标的使用
- 关于Cookie的使用---web Cookie和js Cookie