asmcvc的专栏

创建android component:TaskManagerActivity,并为其创建布局文件taskmanager_layout:

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView style="@style/title_center_text" android:text="进程管理器"/> <View style="@style/splitter_view"/> <LinearLayout style="@style/horizontal_linearlayout"> <Button android:id="@+id/bt_task_user" android:text="用户进程" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1" android:gravity="center"/> <Button android:id="@+id/bt_task_system" android:text="系统进程" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1" android:gravity="center"/> </LinearLayout> <RelativeLayout android:layout_height="match_parent" android:layout_width="match_parent"> <LinearLayout android:orientation="vertical" android:layout_height="match_parent" android:layout_width="match_parent"> <RelativeLayout android:layout_alignParentTop="true" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_weight="1"> <ListView android:id="@+id/lv_usertask" android:layout_height="wrap_content" android:layout_width="match_parent"/> <ListView android:id="@+id/lv_systemtask" android:layout_height="wrap_content" android:layout_width="match_parent"/> </RelativeLayout> <LinearLayout android:layout_weight="0" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_alignParentBottom="true"> <Button android:onClick="selectAll" android:text="全选" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1" android:gravity="center"/> <Button android:onClick="oneKeyClear" android:text="一键清理" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1" android:gravity="center"/> </LinearLayout> </LinearLayout> </RelativeLayout></LinearLayout>

技巧总结:

在垂直布局的LinearLayout中控件从上往下依次排列,除了标题外我们想把底部的空间全部使用起来,因此可以嵌入一个RelativeLayout,,高度和宽度均是match_parent,

这样的属性不会遮挡住标题头,而是从已经排列的控件开始排列。

生气是拿别人做错的事来惩罚自己

asmcvc的专栏

相关文章:

你感兴趣的文章:

标签云: