use*_*673 4 android listview android-layout android-listview
我试图在我的列表视图下面有一个页脚.
这是怎么做的.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:divider="#BE6D79"
android:dividerHeight="3dp" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:background="@color/darkDetna"
android:orientation="horizontal" >
<Button
android:id="@+id/contactBtn"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:paddingRight="0dip"
android:text="Contact" />
<Button
android:id="@+id/faq"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:padding="0dip"
android:text="Terms And Conditions" />
<Button
android:id="@+id/feedback"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:padding="0dip"
android:text="Feedback " />
<Button
android:id="@+id/fullSIte"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:padding="0dip"
android:text="Full Site" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这里
但问题是列表内容很小,或者页脚视图下方只有一个列表项.
我希望页脚固定在屏幕的底部.
在此先感谢您的时间和帮助.
更好用 RelativeLayout
解释实施:
android:layout_alignParentBottom="true"android:layout_above="@+id/LinearLayout1"android:layout_width="fill_parent"和
android:layout_height="fill_parent"更改代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/LinearLayout1"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_weight="1"
android:divider="#BE6D79"
android:dividerHeight="3dp" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@color/darkDetna"
android:orientation="horizontal" >
<Button
android:id="@+id/contactBtn"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:paddingRight="0dip"
android:text="Contact" />
<Button
android:id="@+id/faq"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:padding="0dip"
android:text="Terms And Conditions" />
<Button
android:id="@+id/feedback"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:padding="0dip"
android:text="Feedback " />
<Button
android:id="@+id/fullSIte"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/listselector"
android:padding="0dip"
android:text="Full Site" />
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11542 次 |
| 最近记录: |