Android 如何防止某些视图被键盘推上?
我在视频视图和EditText视图中播放了这个视频, 如何“锁定”屏幕上的视频视图位置,但仍然能够 当键盘显示时,向上推编辑文本 到目前为止,adjustResize和adjustPan都不起作用,也没有使用各种布局类型 正如您所看到的,类似这样的内容,live图标、视图计数器和视频视图保持在原来的位置Android 如何防止某些视图被键盘推上?,android,user-interface,Android,User Interface,我在视频视图和EditText视图中播放了这个视频, 如何“锁定”屏幕上的视频视图位置,但仍然能够 当键盘显示时,向上推编辑文本 到目前为止,adjustResize和adjustPan都不起作用,也没有使用各种布局类型 正如您所看到的,类似这样的内容,live图标、视图计数器和视频视图保持在原来的位置 我希望这能满足您的要求。使用线性布局,将androidOrientation作为垂直方向。并按各自的顺序添加VideoView和EditText [![<?xml version="1.0
我希望这能满足您的要求。使用线性布局,将androidOrientation作为垂直方向。并按各自的顺序添加VideoView和EditText
[![<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<VideoView
android:id="@+id/videoView"
android:layout_width="wrap_content"
android:layout_height="442dp"
android:layout_weight="1"
android:padding="10dp"
android:visibility="visible" />
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textEmailAddress"
android:hint="@string/test"/>
</LinearLayout>
[[
所以,我设法解决了这个问题 我正在使用android:WindowsOfInputMode=“adjustNothing” 以及从这里测量键盘高度(和旋转)的方法 并将我的EditTextView与view.animate().y(值)一起移动 此解决方案还修复了edittext和键盘之间没有空白的问题
看起来很专业,效果也很好。你需要发布你的布局和应用程序的图片,这样我们才能知道我们在处理什么。你不能为单个视图指定特殊行为,但是如果你的布局设置正确且足够稀疏,你可以用一种有意义的方式消除空白。我希望屏幕截图能够澄清这一点。哪个softInpu您正在使用tMode标志?请尝试从“活动”中删除softInputMode属性。希望有帮助