zoukankan      html  css  js  c++  java
  • 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"
  • 相关阅读:
    AOP面向切面编程基础
    记第一次年会主持
    Tomcat服务器部署JavaWeb项目War包基本步骤
    VM14无法将网络更改为桥接状态:没有未桥接的主机网络适配器
    Ubuntu 16.04 安装 IDEA
    Linux之文件挂载
    图片大小
    打开文件、
    Setup Factory
    Repeater获取某一行TextBox值
  • 原文地址:https://www.cnblogs.com/shaoke123/p/4503809.html
Copyright © 2011-2022 走看看