第八节(Activity布局初步一)
16lz
2021-01-23
一、LinearLayout
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <!-- android:orientation="vertical"- -指定控件排列方向 android:layout_width="fill_parent" android:layout_height="fill_parent" --> <!-- android:id="@+id/btn_1"android:layout_width="fill_parent"android:layout_height="wrap_content"android:text="第2行"android:gravity="center"- -指定控件的基本位置比如居中、居右等位置android:textSize="20pt"- -指定控件当中文本字体大小android:background="#aa0000"- -指定控件背景色,使用RGB命名法android:padding....- -指定控件内容的边距android:layout_weight="2"- -指定控件在布局中占用屏幕的比例android:singleLine="true"- -指定控件是的内容是否在同一行中展示 --><TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" android:layout_weight="5" /><Buttonandroid:id="@+id/btn_1"android:layout_width="fill_parent"android:layout_height="wrap_content"android:text="第2行第2行第2行第2行第2行第2行第2行第2行第2行第2行第2行第2行第2行第2行"android:gravity="top"android:textSize="20pt"android:background="#aa0000"android:paddingLeft="10dip"android:paddingTop="1dip"android:paddingRight="30dip"android:paddingBottom="40dip"android:layout_weight="1"android:singleLine="true"/></LinearLayout>
二、TableLayout
<?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="0" > <!-- android:stretchColumns="0"如果不能撑满窗口,拉伸第0列填满窗口 --> <TableRow> <TextView android:text="column1" android:padding="5dip" android:background="#aa0000" /> <TextView android:text="column2" android:padding="5dip" android:background="#0000aa" android:layout_gravity="center_vertical" /> <TextView android:text="column3" android:padding="5dip" android:background="#00aa00" /> </TableRow> <TableRow> <TextView android:text="column1" android:padding="5dip" /> <TextView android:text="column2" android:padding="5dip" /> <TextView android:text="column3" android:padding="5dip" /> </TableRow></TableLayout>
更多相关文章
- Android 日历控件WeekCalendar
- Android GoogleMap的放大缩小地图控件的使用方法
- android 点击空白处收起键盘和自定义EditText实现右下角计数控件
- 第二篇 ListView控件
- Android ProgressBar 自定义样式(六),仿真QQ pad版加载(位置居中)
- Android中的使用ListView控件显示List集合中的数据,并对Item响应
- Android:控件Spinner、getResources、setDropDownViewResource、s
- Android改变图片颜色的自定义控件(十)