【问题标题】:Expandeble list view Always scroll to bottom issue可扩展的列表视图总是滚动到底部问题
【发布时间】:2013-04-19 04:39:17
【问题描述】:

我创建了简单的应用程序,我有显示字典单词的可扩展列表视图。

这个可扩展的列表视图几乎可以正常工作,但是当我触摸任何单词时,它 滚动到底部。任何帮助将不胜感激。

这是我的 Xml 文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <RelativeLayout
        android:id="@+id/dicrellis"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">

        <ExpandableListView
            android:id="@+id/expandable_list"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:cacheColorHint="#00000000"           
            android:transcriptMode="alwaysScroll"/>

    </RelativeLayout>

</RelativeLayout>

这是我的 java 代码...

mExpandableList = (ExpandableListView)findViewById(R.id.expandable_list);
mExpandableList.setAdapter(new MyCustomAdapter(Dictionary.this,arrayParents));
mExpandableList.setOnItemClickListener(this);

【问题讨论】:

    标签: android layout expandablelistview


    【解决方案1】:

    试试这个解决方案。

      <ExpandableListView
      android:id="@+id/expandable_list"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:cacheColorHint="#00000000"           
      android:transcriptMode="normal"/>
    

    只需从此android:transcriptMode="normal"替换android:transcriptMode="alwaysScroll"

    【讨论】:

    • 这个答案对我很有帮助。谢谢。
    【解决方案2】:

    android:transcriptMode="alwaysScroll"当使用这个时,列表会自动滚动到底部,无论当前有哪些项目是可见的。

    其他选项见transcriptMode

    【讨论】:

      猜你喜欢
      • 2019-09-23
      • 1970-01-01
      • 1970-01-01
      • 2016-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多