Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ScrollView没有';当键盘打开时,不要滚动_Android_Keyboard_Scrollview - Fatal编程技术网

Android ScrollView没有';当键盘打开时,不要滚动

Android ScrollView没有';当键盘打开时,不要滚动,android,keyboard,scrollview,Android,Keyboard,Scrollview,我有一个没有填满屏幕的视图,但是当键盘打开时,你不能向下滚动到现在覆盖的几个字段。我尝试在清单和类中添加adjustSize、adjustPan。xml类似于以下条目: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/s" android:layout

我有一个没有填满屏幕的视图,但是当键盘打开时,你不能向下滚动到现在覆盖的几个字段。我尝试在清单和类中添加adjustSize、adjustPan。xml类似于以下条目:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/s"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    >

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/TableLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>
        <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>
        <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>
        <TableRow
        android:id="@+id/tableRow4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>
        <TableRow
        android:id="@+id/tableRow5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>



</TableLayout>
</ScrollView>

当键盘出现时,我需要能够滚动编辑文本和文本视图。提供的链接是解决方案的答案。如果只需在清单中向活动添加“adjustResize”,则无需实施变通方法。您以前遇到的问题是您使用的是adjustPan。当adjustPan不调整窗口大小时,它会平移视图,以便任何具有焦点的对象都不会被软键盘遮挡。如果你查阅谷歌的文档(见下面的链接),这将是有意义的

例如:

<activity android:name="YourActivity" 
          android:windowSoftInputMode="adjustResize" />

将android:windowSoftInputMode=“adjustResize”
添加到AndroidManifest.xml文件中的标记中。这将导致屏幕在显示软键盘后调整为剩余空间。因此,您将能够轻松滚动。

NestedScrollView也有类似的问题。更改为ScrollView有帮助。

很抱歉响应延迟。不过,这确实奏效了。非常感谢。不,没用。添加它会自动向上移动底部按钮…我不想要这个。我只想让它在滚动时可见。“键盘一打开,就不需要了。@AllTimeKing Narendra阅读了adjustResize和adjustPan之间的差异。如果出于某种原因,您确实希望在键盘打开时按钮被键盘遮挡,那么请不要执行这两项操作。对我来说,这听起来像是一个糟糕的用户体验,但如果这是您需要的,那么您需要确保您的视图显然是可滚动的。尝试android:WindowsOfInputMode=“adjustNothing”或在java代码中执行此操作。但是,这应该是一个新问题,因为这是一个不同的问题。如果您的活动使用全屏样式,则它不起作用。或者您必须删除如下内容:getWindow().getDecorView().SetSystemMivibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);在您的代码中。我在ScrollView中应用了这个属性,而不是在Activity中,它运行良好。谢谢