android 登录页面布局,Android开发登陆界面布局

40527094_1.jpg

如果上图所示,就是简单的登录界面了。andord的布局真的是,真的是,哪个。难以掌握的东西,哈,不过一旦了解深入点,又让人爽的不行,流式布局总是比起windows mobile的绝对布局简单而且容易控制。我是越来越倾向于流式布局的方式了,它的一点好处是适应设备时比较灵巧,wm使用了自适应dpi的方式,哪叫一个复杂啊,切不易于控制。

布局的属性 android:layout_width="fill_parent" ,指示了填充父区域,就是父容器有多大空间,就填充多大空间。android:layout_width="wrap_content",指示了它本身需要多大空间,就像父容器索取多大的空间,怎么说呢,就是它有多胖就占多大空。而哪个fill_parent就是不胖也全占满了。

再说android:layout_weight="0.1",这个weight(重量)是个很有意思的东西。可为一个父容器的 “子控件们”设置这个重量属性,父容器根据这个重量的多少择情分给这些子控件们多大空间。同时这个属性还与子控件 宽高属性的显示(fill_parent 或者wrap_content)模式有关。

代码如下:

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="@drawable/images1"

>

android:layout_width="fill_parent"

android:layout_weight="0.9"

android:layout_height="fill_parent">

android:id="@+id/LinearLayout02"

android:layout_weight="0.1"

android:orientation="vertical"

android:layout_height="fill_parent">

android:layout_marginLeft="10px"

android:layout_marginRight="10px"

android:gravity="center"

android:layout_width="fill_parent"

android:id="@+id/LinearLayout_account"

android:orientation="horizontal"

android:layout_height="wrap_content">

android:text="@string/accountName"

android:layout_weight="0.75"

android:layout_width="fill_parent"

android:layout_height="wrap_content">

android:layout_weight="0.25"

android:layout_width="fill_parent"

android:text="mailto:%22 %20android:id=%22@+id/editBoxAccount" android:layout_height="wrap_content">

android:layout_marginLeft="10px"

android:layout_marginRight="10px"

android:gravity="center"

android:layout_width="fill_parent"

android:orientation="horizontal"

android:layout_height="wrap_content">

android:text="@string/password"

android:layout_weight="0.75"

android:layout_width="fill_parent"

android:layout_height="wrap_content">

android:layout_weight="0.25"

android:layout_width="fill_parent"

android:password="true"

android:text="mailto:%22 %20android:id=%22@+id/editBoxPassword" android:layout_height="wrap_content">

android:layout_marginLeft="10px"

android:layout_marginRight="10px"

android:gravity="center"

android:layout_width="fill_parent"

android:orientation="horizontal"

android:layout_height="wrap_content">

android:textSize="9pt"

android:id="@+id/btnLogin" android:layout_width="fill_parent"

android:layout_height="wrap_content">

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值