可扩展列表视图始终滚动到底部问题

Muk*_*kur 5 layout android expandablelistview

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

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

这是我的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>
Run Code Online (Sandbox Code Playgroud)

这是我的java代码......

mExpandableList = (ExpandableListView)findViewById(R.id.expandable_list);
mExpandableList.setAdapter(new MyCustomAdapter(Dictionary.this,arrayParents));
mExpandableList.setOnItemClickListener(this);
Run Code Online (Sandbox Code Playgroud)

Alp*_*pan 9

试试这个解决方案

  <ExpandableListView
  android:id="@+id/expandable_list"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:cacheColorHint="#00000000"           
  android:transcriptMode="normal"/>
Run Code Online (Sandbox Code Playgroud)

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

  • 这个答案对我来说非常有帮助.谢谢. (2认同)