listview不会自动向上滚动,会遮盖内容

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

1
android:windowSoftInputMode="adjustResize"

也无法解决问题。

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

解决了我的问题。

原来的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布局如下:

 1 <ListView
 2         android:id="@+id/lv_suggestion_list"
 3         android:layout_width="match_parent"
 4         android:layout_height="wrap_content"
 5         android:layout_above="@id/bottom_suggestion"
 6         android:layout_below="@id/title_suggestion"
 7         android:cacheColorHint="#00000000"
 8         android:divider="@color/transparent"
 9         android:dividerHeight="8dp"
10         android:listSelector="@color/transparent"
11         android:fastScrollEnabled="true"
12         android:scrollbarStyle="insideInset"
13         android:transcriptMode="normal" />

其中加入了这三个属性:

android:fastScrollEnabled="true"
android:scrollbarStyle="insideInset"
android:transcriptMode="normal"
posted @ 2015-05-14 17:08  mall  阅读(418)  评论(0编辑  收藏  举报