Android: ListView внутри TabHost - PullRequest
       8

Android: ListView внутри TabHost

0 голосов
/ 09 сентября 2011

Я назначаю ListActivity как вкладку Contnet. Все работает нормально, но я не могу увидеть все результаты элемента списка. Я вижу только 2 элемента, которые видны только для половины 2-го элемента, я знаю, что мой список содержит более 100 элементов. Есть догадки?

+++++ EDIT ++++

Tab view Layout:
================

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:background="@drawable/bg" android:layout_height="fill_parent">

    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/tabhost" android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <LinearLayout android:orientation="vertical"
            android:layout_width="fill_parent" android:layout_height="fill_parent">
            <View android:layout_width="fill_parent" android:layout_height="0.5dip"
                android:background="#000" />
            <TabWidget android:id="@android:id/tabs"
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:layout_marginLeft="0dip" android:layout_marginRight="0dip" />
            <View android:layout_width="fill_parent" android:layout_height="2dip"
                android:background="#696969" />
            <View android:layout_width="fill_parent" android:layout_height="2dip"
                android:background="#000" />
            <ScrollView android:id="@+id/ScrollView01"
                android:layout_width="fill_parent" android:layout_height="fill_parent">
                <FrameLayout android:id="@android:id/tabcontent"
                    android:layout_width="fill_parent" android:layout_height="wrap_content">

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


Tab Activity:
=============
onCreate():

        mTabHost = (android.widget.TabHost) findViewById(android.R.id.tabhost);
        mTabHost.setup(getLocalActivityManager());
        mTabHost.getTabWidget().setDividerDrawable(R.drawable.tab_divider);

        Intent list1Intent = new Intent(LIST1);     
        View tabview1 = createTabView(mTabHost.getContext(), "Tab1");
        mTabHost.addTab(mTabHost.newTabSpec("tab1").setIndicator(tabview1)
                .setContent(new Intent(list1Intent)));

        View tabview2 = createTabView(mTabHost.getContext(), "Tab2");
        mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator(tabview2)
                .setContent(commentsIntent));                               
        mTabHost.setCurrentTab(0);      


LIST1 layout:
=============
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content" android:layout_height="fill_parent"
    android:background="@drawable/bg" android:orientation="vertical"
    android:id="@+id/rootView">

    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:id="@+id/cs_list_empty"
        android:text="No Data"></TextView>

    <ListView android:id="@+id/android:list" android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:cacheColorHint="#00000000"
        android:divider="#E6E8E9" android:dividerHeight="2dip" 
        android:clickable="false" android:choiceMode="none" android:focusable="false" />

</LinearLayout>

Спасибо, Венкат Папана

1 Ответ

1 голос
/ 09 сентября 2011

Не следует использовать представление прокрутки с ListActivity, так как оно уже реализует прокрутку, и представление прокрутки прервет оптимизацию, выполненную для действия списка.сделает рамку, чтобы заполнить все оставшееся пространство.

...