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个属于貌似不用设置,也是一样效果的。

  • 相关阅读:
    SpringBoot处理跨域的四种方式
    centos部署nextcloud
    nginx反向代理时配置访问密码
    java对redis的基本操作
    springboot使用redis
    Linux安装redis
    centos安装php7.2环境 (亲测可用)
    linux下后台启动springboot项目
    全局加token
    web移动端浮层滚动阻止window窗体滚动JS/CSS处理
  • 原文地址:https://www.cnblogs.com/qing123/p/5150073.html
Copyright © 2011-2022 走看看