【问题标题】:Expandable list increase scrolling height可扩展列表增加滚动高度
【发布时间】:2016-05-11 07:32:29
【问题描述】:

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

有没有一种方法可以使可展开列表视图的“框架”在展开时更长(可能占据整个屏幕?

这是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"
    />

【问题讨论】:

    标签: android expandablelistview


    【解决方案1】:

    像这样使用 ExpandableLayout 并管理子视图的高度或检查Here (Y)

    <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>
    

    【讨论】:

      【解决方案2】:

      可能使用子内容 xml Max line=3 这样

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-02-02
        • 2021-09-22
        • 2020-03-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多