i need create floorplan can scrolled , zoomed.some sections of plan shall linked other activities (ie. kitchen). idea lay simple button on kitchen-region. click on can kitchen activity.
because of scrolling- , zooming-requirement created webview containing floorplan:
<linearlayout xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".floorplanactivity" xmlns:android="http://schemas.android.com/apk/res/android"> <webview android:id="@+id/webviewfloorplan" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignparentleft="true" android:layout_alignparenttop="true" > <button android:id="@+id/buttonkuehltheke" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button" /> </webview> </linearlayout>
but i'm not able lay button on specific region on floorplan. button appears in upper left corner of floorplan.
mainactivity-code:
webview wvfloorplan = (webview) findviewbyid(r.id.webviewfloorplan); wvfloorplan.getsettings().setbuiltinzoomcontrols(true); wvfloorplan.loadurl("file:///android_asset/services_plan.png");
what needs done set button every postition on webview (floorplan)?
thx arne
if going scrolling , zooming webview, coordinates kitchen section going dynamic, positioning button on difficult.
i suggest overriding webview.shouldoverrideurlloading. way can use html create link kitchen activity.
wvfloorplan.setwebviewclient(new webviewclient() { @override public boolean shouldoverrideurlloading(webview view, string url) { if (url.startswith("act:")) { intent intent = new intent( <kitchen activity> ); startactivity(intent); return true; } return false; } });
you have write html wrapper around image map parts of images different links coordinates static. instead of http urls use href="act:kitchen"
Comments
Post a Comment