安卓 : Showing keyboard hides listview contents

标签 android listview resize android-softkeyboard

喜欢这篇文章:Keyboard hides ListView contents

当键盘可见时,我看不到 ListView 前几行的内容。

因为我的第一个问题是将我的元素放在底部,所以我遵循了以下提示:Android : Showing keyboard moves my components up, i want to hide them instead

但是

android:windowSoftInputMode="adjustPan"

产生了另一个问题,当我的键盘启动时我的 ListView 没有调整大小并且我看不到我的前几行

谢谢

最佳答案

我遇到了同样的问题,并用下面的代码解决了这个问题。

在您的 Activity 中:

mylistview.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
mylistview.setStackFromBottom(true);

或在 xml 文件中

android:stackFromBottom="true"
    android:transcriptMode="normal"

并在 list 文件中保留 adjustResize Activity 。

<activity .... android:windowSoftInputMode="stateHidden|adjustResize" ..../>

来源:Push Listview when keyboard appears without adjustPan

关于安卓 : Showing keyboard hides listview contents,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17790179/

相关文章:

Android Gradle 组常用属性

android - 可检查的相对布局作为多选列表中的项目

c++ - 如何调整数组的大小 C++

android - 实现搜索 Activity android的自定义建议

android - 一起控制两个ViewPager

Android MapView 显示黑屏

Android Recyclerview vs ListView with Viewholder

c# - 在两个组的 ListView 中显示单列

javascript - jquery resize() 不起作用?

html - 如何使用 Bootstrap 表单控件类自动调整内容大小来制作 contenteditable div?