zoukankan      html  css  js  c++  java
  • RelativeLayout中的格局,自适应宽度布局

    RelativeLayout中的布局,自适应宽度布局

    415x25


    该图片中为android布局:
    总布局为 RelativeLayout
    AtLeft 为居左 
    <TextView android:background="#ff0000ff" android:id="@+id/tvwAtLeft"
    android:layout_height="wrap_content" android:layout_width="wrap_content"
    android:text="AtLeft" android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"$amp;>amp;$lt;/TextView>

    AtRight为居右
    <TextView android:layout_height="wrap_content"
    android:layout_width="wrap_content" android:layout_alignParentTop="true"
    android:layout_alignParentRight="true" android:id="@+id/tvwAtRight"
    android:text="AtRight" android:background="#ff0000ff"$amp;>amp;$lt;/TextView>

    Scroll为中间的布局 
    <TextView android:layout_height="wrap_content"
    android:layout_alignParentTop="true" android:layout_toRightOf="@+id/tvwAtLeft"
    android:layout_width="fill_parent" android:id="@+id/tvwScrolling"
    android:layout_toLeftOf="@+id/tvwAtRight" android:text="Scrolling"
    android:background="#FFFF0000"$amp;>amp;$lt;/TextView>

    在中间的布局设置了android:layout_width="fill_parent" 
    android:layout_toRightOf="@+id/tvwAtLeft"
    android:layout_toRightOf="@+id/tvwAtLeft"
    三个属性后,那么将会有类似于LinearLayout布局中的layout_weight="1"(大于0的值)一样的效果,宽度进行了自适应
    经我测试,红色的2个属于貌似不用设置,也是一样效果的。

  • 相关阅读:
    Java基本概念
    Java基础语法
    Java环境的搭建
    elicpse
    常见编译器EOP
    上传突破学习笔记
    认识ollydbg
    160个Crackerme破解
    python基础(1)
    文件上传
  • 原文地址:https://www.cnblogs.com/qing123/p/5150073.html
Copyright © 2011-2022 走看看