在LIstView中使用android:layout_weight="1111"可以修改页面的渲染顺序,必读下面的代码,下面代码中的三个组件中先渲染第一个ImageView再渲染第二个ImageView最后再渲染TextView,这样可以让TexTview自己做到适配
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/iv_icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/ic_launcher"
/>
<TextView
android:id="@+id/tv_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="应用的名字"
android:layout_weight="1111"
/>
<ImageView
android:id="@+id/iv_icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/list_button_lock_default"
/>
</LinearLayout>
还有下面的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
style="@style/TitleStyle"
android:text="进程管理"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="@+id/tv_task_process_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="进行中进程1个"
android:layout_weight="1"
android:layout_marginLeft="5dp"
android:textColor="@color/black"
/>
<TextView
android:id="@+id/tv_task_memory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="剩余/总内存"
android:layout_weight="1"
android:layout_marginLeft="5dp"
android:textColor="@color/black"
/>
</LinearLayout>
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1111"
></ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="全选"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="反选"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="清理"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="设置"
/>
</LinearLayout>
</LinearLayout>