android-当存在键盘时调整ListView的大小

android-当存在键盘时调整ListView的大小,第1张

概述当存在软件键盘时,我在调整列表视图大小方面有一些问题.基本上,我使用的是googlemapsapi,其中地图覆盖了整个屏幕,并带有透明的 *** 作栏,并且我在右侧以片段的形式从幻灯片中看到了一系列的车辆.当右面板显示出来时,整个布局如下所示:现在,我使用的是android:windowSoftInputMode=

当存在软件键盘时,我在调整列表视图大小方面有一些问题.基本上,我使用的是Google maps API,其中地图覆盖了整个屏幕,并带有透明的 *** 作栏,并且我在右侧以片段的形式从幻灯片中看到了一系列的车辆.当右面板显示出来时,整个布局如下所示:

现在,我使用的是android:windowsoftinputMode =“ adjustPan”,因此当我重点编辑文本和键盘时,它看起来像这样:

威奇不好,因为我看不到整车.我曾尝试使用androID:windowsoftinputMode =“ adjustResize”,但由于我使用的是透明 *** 作栏,因此会发生以下情况:
我可以看到整个ListVIEw,并且滚动良好,但是我的EditText现在位于Actionbar下.基本上,我要实现的是这两种情况的组合,因此它看起来像这样:
现在这是我的列表片段的布局

<?xml version="1.0" enCoding="utf-8"?><relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    xmlns:tools="http://schemas.androID.com/tools"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:background="@drawable/bg"    tools:context="hIDden">    <EditText        androID:ID="@+ID/vehicle_search_edit_text"        androID:layout_wIDth="fill_parent"        androID:layout_height="45dp"        androID:focusable="true"        androID:hint="Search"        androID:imeOptions="actionSearch"        androID:singleline="true" />    <ListVIEw        androID:ID="@+ID/List_vehicles"        androID:layout_wIDth="fill_parent"        androID:layout_height="fill_parent"        androID:layout_below="@+ID/vehicle_search_edit_text"        androID:animateLayoutChanges="true"        androID:fastScrollEnabled="true"        /></relativeLayout>

这是我的MainActivity的布局

<?xml version="1.0" enCoding="utf-8"?><relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:ID="@+ID/layout_root"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent">    <relativeLayout        androID:ID="@+ID/layout_root_map"        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent" />    <relativeLayout        androID:ID="@+ID/layout_root_vehicles"        androID:layout_wIDth="350dp"        androID:layout_height="match_parent"        androID:layout_alignParentBottom="true"        androID:layout_alignParentRight="true" />    <relativeLayout        androID:ID="@+ID/layout_root_settings"        androID:layout_wIDth="300dp"        androID:layout_height="wrap_content"        androID:layout_alignParentBottom="true"        androID:layout_alignParentRight="true" /></relativeLayout>

我对设置布局高度非常熟悉,因为我已经在嵌套Listwich片段的布局中进行了设置. Actionbar必须保持透明,因为那是我老板想要的.我整天都在寻找解决方案,但是没有找到对我有用的东西,因此我将非常感谢您的帮助.

解决方法:

我相信,由于您的 *** 作栏类似于Google Maps使用的 *** 作栏,因此通常认为它所占据的空间可用于其他布局(在您的情况下为片段).您尝试为片段容器指定填充或边距,例如:

androID:paddingtop="?androID:attr/actionbarSize"

( *** 作栏的大小).

和…一起

androID:windowsoftinputMode="adjustResize"

这应该工作.

如果填充值不满足您,请手动提供一个更合适的值.

总结

以上是内存溢出为你收集整理的android-当存在键盘时调整ListView的大小全部内容,希望文章能够帮你解决android-当存在键盘时调整ListView的大小所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1077794.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存