Android ListView内部选项卡未填充高度?

Android ListView内部选项卡未填充高度?,android,android-layout,listview,android-tabhost,Android,Android Layout,Listview,Android Tabhost,我使用的是TabHost,在一个选项卡中插入了ListView。我设置了所有的高度来填充家长。但它并没有显示完整的列表,只是其中的一部分。如何使选项卡内容按高度填充屏幕 <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"

我使用的是TabHost,在一个选项卡中插入了ListView。我设置了所有的高度来填充家长。但它并没有显示完整的列表,只是其中的一部分。如何使选项卡内容按高度填充屏幕

   <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/bkg"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="7dp"
            android:layout_marginRight="7dp"
            android:layout_marginTop="7dp"
            android:background="@drawable/gradientrounded"
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/imageView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="15dp"
                android:src="@drawable/taxisign" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/taxiprofiletitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="15dp"
                    android:layout_weight="0.9"
                    android:text="Large Text"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textColor="#000000" />

                <Button
                    android:id="@+id/phonenumber"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="4dp"
                    android:layout_marginLeft="15dp"
                    android:layout_marginRight="15dp"
                    android:layout_marginTop="5dp"
                    android:background="@drawable/button"
                    android:paddingBottom="5dp"
                    android:paddingTop="5dp"
                    android:text="Button"
                    android:textColor="#ffffff" />
            </LinearLayout>

            <ProgressBar
                android:id="@+id/loadFeedbacks"
                style="?android:attr/progressBarStyleLarge"
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_gravity="center"
                android:visibility="invisible" />
        </LinearLayout>

        <TabHost
            android:id="@android:id/tabhost"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#FFFF0000" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical" >

                <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_width="match_parent"
                    android:background="#FF000000"
                    android:layout_height="wrap_content" >
                    <TextView
                        android:tag="tab0"
                        android:text="Инфо"
                        android:background="@android:drawable/btn_star_big_on"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        />
                    <TextView
                        android:tag="tab1"
                        android:text="Отзывы"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        />
                    <TextView
                        android:tag="tab2"
                        android:text="Тарифы"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        />
                </TabWidget>

                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="1" >

                    <LinearLayout
                        android:id="@+id/tab1"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent" >

                        <TextView
                            android:id="@+id/profile_info"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Info" />
                    </LinearLayout>

                    <LinearLayout
                        android:id="@+id/tab2"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical" >

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="vertical" >

                            <TextView android:text="Добавить"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content">

                            </TextView>
                            <ImageButton 
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"/>
                        </LinearLayout>
                        <ListView
                            android:id="@+id/reviewslist"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content" >
                        </ListView>

                    </LinearLayout>

                    <LinearLayout
                        android:id="@+id/tab3"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent" >

                        <ListView
                            android:id="@+id/tariffslist"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_weight="1" >
                        </ListView>

                    </LinearLayout>
                </FrameLayout>
            </LinearLayout>
        </TabHost>


    </LinearLayout>

</ScrollView>


快速查看XML文件时,您的TabHost(LinearLayout)的父项似乎是“wrap\u content”,因此我不确定您是否获得了所有父项。我确实希望有一个更好的UI界面来通过Eclipse构建视觉效果。当这些问题出现时,我不太乐意解决它们。而且他们会经常出现。通常需要反复尝试才能使事情看起来符合我的要求。

在第一次
线性布局时
更改
布局\u height=“match\u parent”
。此外,自API 8以来,
fill\u parent
已被弃用,并被替换为
match\u parent
,因此这是您应该使用的替代方法。

您已将wrap内容用于listView高度。您应该始终使用高度作为匹配父项/填充父项。我想你的问题在这里

                    <ListView
                        android:id="@+id/reviewslist"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" >
                    </ListView>

将其更改为:

                     <ListView
                        android:id="@+id/reviewslist"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent" >
                    </ListView>


除此之外,这种布局似乎并不有效。不建议使用滚动视图中的列表视图。

滚动布局是不必要的,将其删除,使代码正常工作

我有此问题,但需要滚动视图才能滚动所有页面!