我做不到,它不关注 webview 的输入或文本区域
我点击了最后一次输入。;
http://i.stack.imgur.com/MGG3L.png
应该和这个一样(安卓浏览器)
http://i.stack.imgur.com/WFRta.png
我该怎么办?
主要 Activity .js;
webview = (WebView) findViewById(R.id.webView1);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://mutlugunluk.com");
webview.requestFocus(View.FOCUS_DOWN);
webview.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
if (!v.hasFocus()) {
v.requestFocus();
}
break;
}
return false;
}
});
Activity 主体
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
list
<activity
android:windowSoftInputMode="adjustPan|adjustResize"
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
最佳答案
您是否尝试将 Window SoftInput Mode 属性设置为 Activity 的 adjustPan 和 adjustResize?
在为该 Activity 设置的 Manifest.xml 中:
<activity android:windowSoftInputMode="adjustPan|adjustResize"> </activity>
当键盘弹出时,这应该可以实现将所有内容向上移动的“技巧”。
注意:如果顶部元素是 RelativeLayout,这应该有效,所以尝试将 LinearLayout 更改为 RelativeLayout
关于android - Android 上的软键盘会遮盖文本框,因此用户看不到正在输入的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32171294/