Java 启动片段并滚动时,键盘打开
我的片段中有一个滚动视图,当片段打开时,键盘会自动显示并聚焦于版面的第一个编辑文本,屏幕滚动,当键盘打开时,我看不到所有字段。 那么,当片段开始时,我可以做些什么来防止键盘出现,以及在键盘打开的情况下,我可以做些什么来查看scrollview中的所有字段 谢谢 这是XML的一部分Java 启动片段并滚动时,键盘打开,java,android,xml,android-studio,Java,Android,Xml,Android Studio,我的片段中有一个滚动视图,当片段打开时,键盘会自动显示并聚焦于版面的第一个编辑文本,屏幕滚动,当键盘打开时,我看不到所有字段。 那么,当片段开始时,我可以做些什么来防止键盘出现,以及在键盘打开的情况下,我可以做些什么来查看scrollview中的所有字段 谢谢 这是XML的一部分 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/r
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/personalDataLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context=".presentation.fragments.PersonalDataFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
可聚焦的最高级别视图将被聚焦。如果键盘已聚焦,请将其向上拉。但如果将以下内容添加到父视图(RelativeLayout、LinearLayout等),则键盘不会自动打开
android:focusable="true"
android:focusableInTouchMode="true"
例如:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_height="match_parent">
你能发布一些代码让我们看看你的设置是什么吗?只是显示片段所需的最小值。很酷,这在打开键盘时起作用,但我仍然有一个问题,当我打开键盘时,scrollView会滚动,而我看不到顶部的编辑文本