• Android


    这里汇总的是自己在工作过程中,使用过的常见空间布局,记录在这里。详情如下:

    1. 三个控件,分别处于左,中,右

    要点:使用RelativeLayout

     1     <RelativeLayout
     2                 android:layout_width="match_parent"
     3                 android:layout_height="wrap_content"
     4                 android:orientation="horizontal">
     5             <TextView
     6                     android:layout_width="wrap_content"
     7                     android:layout_height="wrap_content"
     8                     android:gravity="center"
     9                     android:layout_alignParentLeft="true"/>
    10             <TextView
    11                     android:layout_width="wrap_content"
    12                     android:layout_height="wrap_content"
    13                     android:gravity="center"
    14                     android:layout_centerHorizontal="true"/>
    15             <TextView
    16                     android:layout_width="wrap_content"
    17                     android:layout_height="wrap_content"
    18                     android:gravity="center"
    19                     android:layout_alignParentRight="true"/>
    20     </RelativeLayout>

    2. 两个控件,分别处于左右

    要点:使用layout_weight="1"的TextView撑开中间,将两个控件挤到两边

     1         <LinearLayout
     2             android:layout_width="match_parent"
     3             android:layout_height="wrap_content"
     4             android:orientation="horizontal">
     5             <TextView
     6                     android:layout_width="wrap_content"
     7                     android:layout_height="wrap_content"
     8                     android:gravity="center"
     9                     android:layout_gravity="center"/>
    10             <TextView
    11                     android:layout_width="wrap_content"
    12                     android:layout_height="wrap_content"
    13                     android:layout_weight="1" />
    14             <TextView
    15                     android:layout_width="wrap_content"
    16                     android:layout_height="wrap_content"
    17                     android:gravity="center"
    18                     android:layout_gravity="center"/>
    19         </LinearLayout>

    持续更新......

  • 相关阅读:
    WPF通过不透明蒙板切割显示子控件
    WPF图片,DataGrid等实现圆角
    今天是2015年1月5日
    控制反转&依赖注入
    如何提高sql查询性能到达优化程序的目的
    handle句柄
    winform加快窗体加载速度
    winform窗体自适应大小
    快速整理代码(c#)
    IC卡、ID卡、M1卡、射频卡的区别是什么(射频卡是种通信技术)
  • 原文地址:https://www.cnblogs.com/KevinSong/p/5642810.html
Copyright © 2020-2023  润新知