gpt4 book ai didi

android - 可扩展列表增加滚动高度

转载 作者:行者123 更新时间:2023-11-30 01:20:42 24 4
gpt4 key购买 nike

我有一些内容占据了 Activity 屏幕 View 的一半。在下半部分,我有我的可扩展 ListView ,它在折叠时只有 100dp 高。但是,当我展开它并且列表开始变长时,它只显示在屏幕的下半部分,这确实限制了看到的内容量。

有没有办法让可展开 ListView 的“框架”在展开时变长(也许让它占据整个屏幕?

这是xml文件中的相关样式:

// Top content...

<ExpandableListView
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/my_courses_expandable_list"
android:groupIndicator="@android:color/transparent"
android:dividerHeight="0dp"
android:divider="@color/white"
/>

最佳答案

像这样使用 ExpandableLayout 并管理 subview 的高度或检查 Here (是)

<com.kaushal.demo.ExpandableLayout
android:id="@+id/expandablelayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp">

<TextView
android:id="@+id/textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"/>

<TextView
android:id="@+id/expandable_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:gravity="center"
app:canExpand="true"/>
</com.kaushal.demo.ExpandableLayout>

关于android - 可扩展列表增加滚动高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37155934/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com