I have an activity with LinearLayout as its main Layout. In that layout, there is a button that adds a View (R.layout.motor_block) to the main layout (R.id.layout):
LayoutInflater inflater =
(LayoutInflater)this.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
View iv = inflater.inflate( R.layout.motor_block, null );
RelativeLayout rl = (RelativeLayout) findViewById(R.id.layout);
rl.addView(iv);
This works fine, but when I add more Views, the screen gets filled up with them so I need a way to "extend" the size by adding pan so I can go through all the views. I also want to add zoom.
I tried to use a WebView:
RelativeLayout rl = (RelativeLayout) findViewById(R.id.layout);
WebView wv = (WebView) findViewById(R.id.webView1);
wv.getSettings().setSupportZoom(true);
wv.getSettings().setBuiltInZoomControls(true);
wv.getSettings().setUseWideViewPort(true);
wv.getSettings().setLoadWithOverviewMode(true);
wv.getSettings().setDisplayZoomControls(false);
wv.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
wv.addView(iv);
The Views get added to it, and pan works. The problem is that when I zoom, the webView zooms the background, and the Views don't change size.
I also tried some custom views but they didn't support views with child views.
What is the best way to accomplish this?