HTML5 经量级框架 jQuery Mobile 视图与页面 - 7.2

来源:互联网 发布:mac usb电压不足 编辑:程序博客网 时间:2024/06/06 07:11

xml:

<?xml version="1.0" encoding="UTF-8"?>
<AbsoluteLayout android:orientation="vertical" android:id="@+id/tab1" android:layout_width="fill_parent" android:layout_height="fill_parent"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <WebView android:id="@+id/wv"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_x="0.0dip"
        android:layout_y="0.0dip"
        android:layout_weight="1.0" />
</AbsoluteLayout>


java:

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
          
        WebView wView = (WebView)findViewById(R.id.wv);     
        WebSettings wSet = wView.getSettings();     
        wSet.setJavaScriptEnabled(true);     
                     
        wView.loadUrl("file:///android_asset/www/index.html");    
        //wView.loadUrl("content://com.android.htmlfileprovider/sdcard/index.html");  
//        wView.loadUrl("http://www.baidu.com");  
    }

}


html:

<!DOCTYPE HTML>
<html>
  <head>
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>PhoneGap</title>

      
      <link rel="stylesheet" href="jquery.mobile-1.3.1.css">
      
      <script type="text/javascript" charset="utf-8" src="jquery-1.9.0.min.js"></script>
      <script type="text/javascript" charset="utf-8" src="jquery.mobile-1.3.1.js"></script>
  </head>
  <body>
    <section data-role="page">
        <header data-role="header">页头</header>
        <article data-role="content">内容</article>
        <footer data-role="footer">页脚</footer>
    </section>
  </body>
</html>





原创粉丝点击