【问题标题】:Android ExpandableListView sliding childrenAndroid ExpandableListView 滑动子项
【发布时间】:2013-05-07 07:32:18
【问题描述】:

我目前正在尝试开发一个可扩展列表视图,每组有两个或更多孩子。 它工作正常,但现在我想为孩子制作幻灯片动画,当用户点击父母时。

我找到了这个库https://github.com/tjerkw/Android-SlideExpandableListView,它非常适合每个组一个项目。我尝试扩展 xml 布局文件,以便我可以使用比每组一个更多的项目。但它似乎不起作用。

这是原始文件。它包括每组一行中的两个按钮。

<LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/expandable"
        android:background="#000000">


        <Button
                android:id="@+id/buttonA"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:layout_weight="0.5"
                android:text="Action A"
                android:textSize="12dip"/>


        <Button
                android:id="@+id/buttonB"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:layout_weight="0.5"
                android:text="Action B"
                android:textSize="12dip"/>
</LinearLayout>

但是当我现在尝试扩展这个布局时,例如这样:

<LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/expandable"
        android:background="#000000">

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <Button
                android:id="@+id/buttonA"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:text="Action A"
                android:textSize="12dip"/>
    </LinearLayout>

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <Button
                android:id="@+id/buttonB"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:text="Action B"
                android:textSize="12dip"/>
        </LinearLayout>
</LinearLayout>

向下滑动的“空间”变大了,但我只能看到第一个按钮。第二个按钮应该显示的地方是空的。

有人知道吗?

【问题讨论】:

    标签: android expandablelistview slide children


    【解决方案1】:

    请将父布局方向更改为垂直解决您的问题。

    【讨论】:

    • 我怎么会这么笨,这么简单的错误 :D 谢谢你的帮助,效果很好!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-25
    • 1970-01-01
    相关资源
    最近更新 更多