Android 中的软键盘隐藏了 EditText
EditText is hidden by the softkeyboard in Android
我在一个应用程序中有一个对编辑文本有视差效果的布局,我的问题是**当我点击编辑文本软键盘时隐藏了我的编辑文本?**任何人都可以帮我解决这个问题,我已经搜索过了并发现“WindowsoftInputmode”在我的情况下不起作用。
清单中的代码
<activity
android:name="one.tusk.stush.activities.NewPostDetailActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|adjustPan" >
在您的清单中试试这个,
<activity
android:name=".rapcalsy.MainActivity"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
根据这个改变你的布局,
不要错过
这一行
android:isScrollContainer="true"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:isScrollContainer="true"
android:orientation="vertical">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="#000000"
android:padding="0dp"
android:stretchColumns="*">
...
</TableLayout>
</ScrollView>
您应该只使用 android:windowSoftInputMode="adjustResize"
。
如果这还不够,您可能需要将 属性 android:fitsSystemWindows="true"
添加到包含您的 EditText 的根布局。
请尝试一下。
在 Manifest 中将 android:softInputMode 属性设置为 adjustResize 并将父布局放在 滚动视图。希望这有帮助。
我按照你说的做了一些尝试然后我开始工作了
编辑您的清单文件
<activity
android:name="one.tusk.stush.activities.NewPostDetailActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible" >
然后在 java class
的 oncreate 中添加下面一行代码
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
这样键盘就不会显示给你了directly/always
我在一个应用程序中有一个对编辑文本有视差效果的布局,我的问题是**当我点击编辑文本软键盘时隐藏了我的编辑文本?**任何人都可以帮我解决这个问题,我已经搜索过了并发现“WindowsoftInputmode”在我的情况下不起作用。
清单中的代码
<activity
android:name="one.tusk.stush.activities.NewPostDetailActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|adjustPan" >
在您的清单中试试这个,
<activity
android:name=".rapcalsy.MainActivity"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
根据这个改变你的布局, 不要错过
这一行android:isScrollContainer="true"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:isScrollContainer="true"
android:orientation="vertical">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="#000000"
android:padding="0dp"
android:stretchColumns="*">
...
</TableLayout>
</ScrollView>
您应该只使用 android:windowSoftInputMode="adjustResize"
。
如果这还不够,您可能需要将 属性 android:fitsSystemWindows="true"
添加到包含您的 EditText 的根布局。
请尝试一下。
在 Manifest 中将 android:softInputMode 属性设置为 adjustResize 并将父布局放在 滚动视图。希望这有帮助。
我按照你说的做了一些尝试然后我开始工作了 编辑您的清单文件
<activity
android:name="one.tusk.stush.activities.NewPostDetailActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible" >
然后在 java class
的 oncreate 中添加下面一行代码 getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
这样键盘就不会显示给你了directly/always