当键盘应用时,Listview项目不会向上滚动

时间:2017-05-01 07:20:14

标签: android listview scroll keyboard

我的listview包含20行,

item--1
item--2
.
.
item--19
item--20

这是可滚动的

列出最后一项

项目 - 17点击 keyboad出现了它的封面editexs 现在item--15显示

item--15
EDITTEXT
KEYBOARB

滚动到项目 - 15 我申请了SOFT INPUT ADJUST PAN

然后现在 显示item--17布局向上移动

item--16
item--17
KEYBOARD

现在滚动到项目 - 17 但我的问题是

项目 - 17我有下一个项目 - 18和项目 - 19和项目 - 20

当键盘出现时,项目-17仅显示滚动。

下一项没有显示。 如何滚动最后的项目。

  

activity_main.xml中

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

        <ListView
            android:id="@+id/list_item"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        </ListView>
</LinearLayout>

3 个答案:

答案 0 :(得分:1)

您可以使用RecycleView而不是Listview

答案 1 :(得分:-1)

在您的清单活动标记中放置android:windowSoftInputMode="adjustPan|adjustResize"属性,请参见下面的示例

<activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="adjustPan|adjustResize">

答案 2 :(得分:-1)

android:windowSoftInputMode="adjustPan"中使用AndroidMainfest.xml或在类文件getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);中添加