1. -- > 新建项目Android3.0
2. -- > AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.geolo.android"
android:versionCode="1"
android:versionName="1.0" >
<application
android:icon="@drawable/icon"
android:label="@string/app_name" >
<activity android:name="com.demo.flash.BrowserTest" android:hardwareAccelerated="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<!-- 使WebView全屏 -->
<supports-screens
android:anyDensity="true" android:largeScreens="true" android:normalScreens="true"
android:resizeable="true" android:smallScreens="true" >
</supports-screens>
</manifest>
3. --> webview.xml 布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<WebView
android:id="@+id/wbShow"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
4. --> BrowserTestActivity
public class BrowserTestActivity extends Activity {
private WebView wbShow;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
wbShow = (WebView)this.findViewById(R.id.wbShow);
<!-- 设置javascript脚本可用 -->
wbShow.getSettings().setJavaScriptEnabled(true);
wbShow.getSettings().setPluginsEnabled(true);
wbShow.loadUrl("file:///android_asset/sample/flash.swf");
}
@Override
protected void onPause(){
super.onPause();
wbShow.pauseTimers();
if(isFinishing()){
wbShow.loadUrl("about:blank");
setContentView(new FrameLayout(this));
}
}
@Override
protected void onResume(){
super.onResume();
wbShow.resumeTimers();
}
}