美文网首页
WebView和jQueryMobile

WebView和jQueryMobile

作者: Kagashino | 来源:发表于2017-02-27 19:04 被阅读0次

WebView

WebView是Java的一个Package,可以让安卓终端解释运行HTML页面
使用Eclipse或者Android Studio创建一个空项目时,软件会自动生成一个默认活动页面Hello World,但是这个页面是有导航条的,如果我们要生成一个不带导航条的活动,需要在创建项目下的AndroidManifest.XML文件进行修改:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.hybrid"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="19"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >//修改这一行:意为
//黑色不带导航条的全屏活动
        <activity
            android:name="com.example.hybrid.MainActivity1"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

在主Java文件中,去掉不必要的代码,导入WebView包获取:

package com.example.hybrid;

import android.app.Activity;
import android.app.ActionBar;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;//导入这个
import android.os.Build;

public class MainActivity1 extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        WebView wv = new WebView(this);
        this.setContentView(wv);
        wv.loadUrl("file:///android_assets/index.html");
    }

}

jQuery Mobile

讲咁多做咩啊,直接上骨架,看看都需要导入什么文件和元素属性的写法

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="https://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>

<div data-role="page">
  <div data-role="header">
    <h1>这里是题头</h1>
  </div>

  <div data-role="main" class="ui-content">
    <p>主题部分</p>
  </div>

  <div data-role="footer">
    <h1>页脚</h1>
  </div>
</div> 

</body>
</html>

相关文章

  • WebView和jQueryMobile

    WebView WebView是Java的一个Package,可以让安卓终端解释运行HTML页面使用Eclipse...

  • jQueryMobile

    一. JQueryMobile 二. jqueryMobile-page跳转及过场动画 三. jqueryMobi...

  • JQueryMobile入门1

    示例: 使用dataset属性驱动的jQueryMobile组件 jQueryMobile提供了丰富的UI界面库,...

  • base

    JQuerymobile是开发手机html一个专业的框架,现在从0开始学习JQuerymobile,为了记录学习我...

  • jQueryMobile

    Images A hidden message: ...

  • jquerymobile

    data-role参数表:page 页面容器,其内部的mobile元素将会继承这个容器上所设置的属性...

  • jQueryMobile

    一. JQueryMobile jQuery Mobile是一个基于HTML5的用户界面系统,旨在使所有智能手机,...

  • xdl9

    jquery mobile简介 jquerymobile是以jquery为基础的. 接口和使用的页面样式都是为了达...

  • jQueryMobile总结

    jQuery Mobile Data属性 按钮: 如果组合多个按钮,请使用带有data-role="control...

  • jQuery UI

    http://jqueryui.com/download/ http://jquerymobile.com/dow...

网友评论

      本文标题: WebView和jQueryMobile

      本文链接:https://www.haomeiwen.com/subject/lcizwttx.html