显示软键盘时无法使ScrollView滚动

显示软键盘时无法使ScrollView滚动,第1张

显示软键盘时无法使ScrollView滚动

android:windowSoftInputMode="adjustResize"
<activity>

标签添加到您的AndroidManifest.xml中。这将导致屏幕被调整为显示软件键盘后剩余的空间。结果,您将能够滚动,因为屏幕不会以任何方式被键盘覆盖。

编辑:

我已经写了一个最小的示例并对其进行了测试。除非有巨大的误解,否则请尝试下面的代码,然后找出为什么您的代码不起作用:

xml布局:

<?xml version="1.0" encoding="utf-8"?><ScrollView    xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_height="fill_parent"    android:layout_width="fill_parent"    >    <LinearLayout        android:orientation="vertical"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        >        <TextView android:layout_height="2000dp" android:layout_width="wrap_content" android:gravity="top" android:text="Scroll Down!"/>        <EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:hint="Enter Text" />    </LinearLayout></ScrollView>

表现:

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"          package="com.example"          android:versionCode="1"          android:versionName="1.0">    <uses-sdk android:minSdkVersion="15"/>    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">        <activity android:name="MyActivity"       android:label="@string/app_name"     android:windowSoftInputMode="adjustResize"     > <intent-filter>     <action android:name="android.intent.action.MAIN"/>     <category android:name="android.intent.category.LAUNCHER"/> </intent-filter>        </activity>    </application></manifest>


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

原文地址:https://54852.com/zaji/5489084.html

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

发表评论

登录后才能评论

评论列表(0条)

    保存