FrameLayout

帧布局在fragment中必须使用时才会使用,一般不使用
属性
visibility:
visible:显示
invisible:不显示但是占用空间
gone:不显示也不占用,相当于没有
该属性在Android的所有布局中通用,其他属性的使用与线性布局相似。

<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent" android:layout_height="match_parent">    <Button        android:layout_width="240dp"        android:layout_height="240dp"        android:text="Button1"        android:visibility="visible"        android:background="#ff0000"        />    <Button        android:layout_width="180dp"        android:layout_height="180dp"        android:text="Button2"        android:visibility="invisible"        android:background="#0fff00"        />    <Button        android:layout_width="140dp"        android:layout_height="140dp"        android:text="Button3"        android:visibility="gone"        android:layout_marginBottom="15dp"        android:background="#00fff00"        />    <Button        android:layout_width="140dp"        android:layout_height="140dp"        android:text="Button3"        android:visibility="visible"       android:layout_marginLeft="20dp"        android:layout_marginTop="20dp"        android:background="#f0ff00"        />FrameLayout>

使用visible

使用invisible

TableLayout

TableLayout中每写一行或一列都要写相应的Table Row()或是Table Columns()
属性
stretchColumns:空白填充
shrinkColumns:设置行不被挤出屏幕
collapseColumns:隐藏列
Layout_span:设置某行的行数

<?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent" android:layout_height="match_parent"    android:stretchColumns="1"    android:shrinkColumns="1"   >    <TableRow>        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button1"            />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button22222222222222222222222222222"            />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button3"            />    TableRow>    <TableRow>        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button1"            />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button2"            />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button3"            />    TableRow>    <TableRow>        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button1"            />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button2"            />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button3"            />    TableRow>TableLayout>

未使用stretchColumns

使用stretchColumns(空白填充)

使用collapseColumns(隐藏列)

使用shrinkColumns(保证其他组件不被挤出屏幕)

layout_span的使用

<?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent" android:layout_height="match_parent"   >    <TableRow>        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button1"            />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_span="2"            android:text="Button22222222222222222222222222222"            />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button3"            />    TableRow>    <TableRow>        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button1"            />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button2"            />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button3"            />    TableRow>    <TableRow>        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button1"            />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button2"            />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="Button3"            />    TableRow>TableLayout>

更多相关文章

  1. 浅谈Android下拉菜单Spinner
  2. 详解Android(安卓)ActionBar之一:ActionBar概述与创建
  3. Adapter那点事
  4. Android基本之UI Layout
  5. Delphi XE5 for Android(安卓)(五)
  6. Android(安卓)adbd配置
  7. 第15章、布局Layouts之TableLayout表格布局(从零开始学Android)
  8. Android属性动画初步
  9. Android:可复制内容的TextView、EditText

随机推荐

  1. Android 各种Context区别
  2. Android滚动文字效果
  3. android 按纽状态配置文件
  4. android --- 2g/3g流量问题实例
  5. android 几个快速编译image的指令
  6. Android:setLatestEventInfo问题
  7. Android ble setCharactersticNotificati
  8. 戏说Android四大组件之Activity
  9. android之获得当前连接wifi的名字
  10. android中菜单的使用