我正在制作
android phonegap应用程序.
我在CordovaWebView下设置了editText.我想获得键盘显示/隐藏事件.
尝试计算视图高度,但失败.当editText具有焦点时,将显示键盘.但CordovaWebView上升,视图大小不变.所以我无法获得键盘显示的事件.
我在CordovaWebView下设置了editText.我想获得键盘显示/隐藏事件.
尝试计算视图高度,但失败.当editText具有焦点时,将显示键盘.但CordovaWebView上升,视图大小不变.所以我无法获得键盘显示的事件.
为什么视图上升?
这是我的部分代码.
MainActivity onCreateMethod()
int layoutId = R.layout.blank; layout = new LinearLayout(this); setContentView(layoutId); layout.setOrientation(LinearLayout.VERTICAL); textedit = ((Activity) this).getLayoutInflater().inflate(R.layout.main,null); layout.addView((View) appView.getParent()); layout.addView(textedit); layout.getChildAt(0).setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,1)); setContentView(layout);
RES /布局/ blank.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> </LinearLayout>
RES /布局/ main.xml中
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <EditText android:id="@+id/editText1" android:layout_width="fill_parent" android:layout_height="fill_parent"> </LinearLayout>
请帮忙….