0

是否可以在带有滚动视图的 android 中使用自定义可扩展列表视图?

4

5 回答 5

1

ListView 已经关联了 scrollView,可以使用 MergeAdapter 来实现

于 2011-02-14T10:53:36.023 回答
1

ExpandableListView 有自己的列表视图。您不必在其上集成另一个列表视图。请注意,如果您有一个长列表,则垂直滚动会自动关联。

于 2011-10-25T07:17:50.630 回答
1

我认为你们中的任何人都没有正确地回答他的问题!他在询问“可扩展”列表视图。无论如何,我似乎也有同样的疑问。

我仍然认为答案是否定的。

您也许可以使用自定义视图并将它们膨胀到已经存在的布局元素中,这将为您提供相同的效果。而且我认为这个解决方案会更好。

于 2011-03-13T16:22:55.170 回答
0

列表视图与滚动视图的组合并不是一个好的选择。如果您将任何列表视图放置在滚动视图中,则列表视图将不会滚动。谷歌安卓程序员似乎官方说这将是一个糟糕的用户体验。

于 2011-02-14T09:02:26.217 回答
0

当然,可扩展列表视图与 VERTICAL 滚动视图的组合并不是一个好的选择,但在 Horizo​​ntalScrollView 中使用它的效果令人印象深刻。我在我的程序中使用这种方法。用户可以水平滚动长字符串。

    <?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout
    android:id="@+id/RelativeView01"
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    >
    <Button
            android:id="@+id/btnSaveSelection"
            android:layout_alignParentLeft="true"
            android:layout_width="100dip"
            android:layout_height="50dip"
            android:layout_alignParentBottom="true"
            android:text="@string/SaveSelection"
            android:focusable="true"
            android:background="@drawable/android_button"
            android:onClick="myClickHandler14" />
        .........
<HorizontalScrollView 
    android:id="@+id/HorizontalScrollView01" 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent"
    android:scrollbars="horizontal|vertical"
    android:layout_above="@id/button_add_group"
    android:layout_alignParentTop="true"> 
    <LinearLayout android:id="@+id/LinearLayout02" 
        android:layout_width="wrap_content" 
        android:orientation="vertical" 
        android:layout_height="wrap_content"> 
        <ExpandableListView android:id="@+id/android:list"
                android:layout_width="750px"
                android:layout_height="wrap_content"
                android:groupIndicator="@android:color/transparent" />
            <TextView android:id="@+id/android:empty"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#000000"
                android:text="@string/no_data"/>
    </LinearLayout>
</HorizontalScrollView>
</RelativeLayout>  
于 2011-11-26T15:06:13.540 回答