使用ListView,弹出输入法遮盖内容的解决方法

在使用listView显示聊天窗口时,弹出输入法,listview不会自动向上滚动,会遮盖内容,在manifest中的Activity加入:html

android:windowSoftInputMode="adjustResize"

也没法解决问题。android

经过百度,找到一位童鞋的博客:http://blog.sina.com.cn/s/blog_9564cb6e0101g2eg.htmlide

解决了个人问题。布局

原来的ListView布局以下:
测试

<ListView
        android:id="@+id/lv_suggestion_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/bottom_suggestion"
        android:layout_below="@id/title_suggestion"
        android:cacheColorHint="#00000000"
        android:divider="@color/transparent"
        android:dividerHeight="8dp"
        android:listSelector="@color/transparent"
        android:paddingBottom="4dp"
        android:paddingTop="4dp" />

修改事后的ListView布局以下:spa

<ListView
        android:id="@+id/lv_suggestion_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/bottom_suggestion"
        android:layout_below="@id/title_suggestion"
        android:cacheColorHint="#00000000"
        android:divider="@color/transparent"
        android:dividerHeight="8dp"
        android:listSelector="@color/transparent"
        android:fastScrollEnabled="true"
        android:scrollbarStyle="insideInset"
        android:transcriptMode="normal" />

其中加入了这三个属性:code

android:fastScrollEnabled="true"
android:scrollbarStyle="insideInset"
android:transcriptMode="normal"

orm


通过测试,在弹出输入框时,ListView能够正常向上移动,不会遮盖起内容。
xml

相关文章
相关标签/搜索