It is doable. The cordova pointer gives some hint.
Also suppose MyActivity extends DriodGap, then you need
1) override init() method
2) resize the first (original view) so that it does not occupy the entire screen
this.appView.setLayoutParams(new LinearLayout.LayoutParams( [desired width], [desired height], ));
3) Create a new CordovaWebView, set its LayoutParams, similar to the first. Then add it to root mode:
this.root.addView(cwv2);
4) Two web views should be displayed now. But if there are inputs in two views, you will find that there is focus on both inputs.
5) To get rid of the dual focus problem, paste the following code:
this.appView.requestFocus(View.FOCUS_DOWN); this.appView.setOnTouchListener(new View.OnTouchListener() { 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; } });
source share