android LinearLayout布局嵌套覆盖问题

在做android  UI布局时,用了LinearLayout嵌套,发现效果并不如我预料一般查了下资料,说是要设置layout_weight属性资料说得不是很清楚,也没仔细看,就去弄,结果越弄越混乱。于是静下心来,自己写xml测试,发现如下。我用eclipse开发,用android Common XML Editor   使用快捷键alt+/一、如果LinearLayout是最
摘要由CSDN通过智能技术生成

在做android  UI布局时,用了LinearLayout嵌套,发现效果并不如我预料一般

查了下资料,说是要设置layout_weight属性

资料说得不是很清楚,也没仔细看,就去弄,结果越弄越混乱。

于是静下心来,自己写xml测试,发现如下。

我用eclipse开发,用android Common XML Editor   使用快捷键alt+/

一、如果LinearLayout是最外面的一层,它是不会弹出layout_weight属性的

换句话说最外层不能用layout_weight

二、xml布局如下

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
>
  <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical">
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="zzzzzzzzzzzzzzzzzzzzzzzzzzzzz" 
        android:textSize="18sp"
        android:layout_marginLeft="5px"
        android:layout_marginBottom="10px"
        android:textColor="@android:color/darker_gray"
       />
    
    <TextView  android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="xxxxxxxxxxxxxxxxxxxxxxx"
        android:layout_marginLeft="50px"
        android:layout_marginBottom="10px
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值