【发布时间】:2013-11-11 09:17:59
【问题描述】:
为了防止多个 GetView 调用,我将 ListView 的高度设置为 fill_parent。
如何显示除 ListView 本身之外的其他视图?
以下布局在 ViewPager 中膨胀:
<?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"
android:padding="15dp" >
<ListView android:id="@+id/lv_viol_infraction"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<include layout="@layout/activity_prontuario_home" />
</LinearLayout>
包含的布局在哪里:
<?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:orientation="vertical"
android:padding="20dp" >
<ScrollView
android:id="@+id/prontuariohome_scrollview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="none" >
.
.
.
.
</ScrollView>
</LinearLayout>
编辑:This solution 不适用于高于按钮的视图
【问题讨论】:
-
如果你使用 fill_parent 作为高度,你不能这样做。
-
如何阻止 getview 被调用?它将被调用的次数作为列表项的大小。
-
不清楚你想达到什么目的
标签: android android-layout listview include