布局文件中放入ListView之后,在底部加其他控件正常情况会不显示,试出来个小例子,记录一下。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:id="@+id/ll_head"
android:layout_weight="0.8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/iv_me"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
/>
<TextView
android:id="@+id/tv_introduce"
android:paddingTop="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="推荐"
android:textSize="30dp"
android:layout_centerHorizontal="true"
/>
<ImageView
android:id="@+id/iv_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
<ListView
android:id="@+id/lv_content"
android:layout_marginTop="10.0dip"
android:layout_weight="10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="20dp"
>
</ListView>
<RelativeLayout
android:id="@+id/ll_foot"
android:layout_weight="0.8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<Button
android:id="@+id/btn_joke"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_launcher"
android:text="段子"
/>
<Button
android:id="@+id/btn_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/btn_joke"
android:drawableTop="@drawable/ic_launcher"
android:text="图片"
/>
<Button
android:id="@+id/btn_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_launcher"
android:layout_centerHorizontal="true"
android:text="视频"
/>
<Button
android:id="@+id/btn_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/btn_video"
android:drawableTop="@drawable/ic_launcher"
android:text="发现"
/>
<Button
android:id="@+id/btn_check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:drawableTop="@drawable/ic_launcher"
android:text="审核"
/>
</RelativeLayout>
</LinearLayout>
其他在底部加控件的参考网页:
http://www.cnblogs.com/loulijun/archive/2012/10/25/2738952.html