寫Android App相對比較簡單的方式,可能就是WebView+HTML5,Jimmy's papa這次試著將之前寫得麥田圈網頁,包到.apk裡面,呈現效果還蠻優的,下次再來測試看看有無支援多點觸控
<?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="wrap_content"
>
<WebView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/wv"
/>
</LinearLayout>
package com.jimmyscratchlab.web;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import com.jimmyscratchlab.web.R;
public class HelloWebActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView wv;
wv = (WebView) findViewById(R.id.wv);
wv.getSettings().setJavaScriptEnabled(true);
//wv.loadUrl("file:///sdcard/cropcircle.html");//Local file
wv.loadUrl("file:///android_asset/cropcircle.html");//APK
}
}
多點觸控 放大縮小
回覆刪除WebSettings bs = webView.getSettings();
bs.setBuiltInZoomControls(true);
webView.getSettings().setSupportZoom(true); webView.getSettings().setBuiltInZoomControls(true);
感謝!!!
刪除