Android Studio打包H5網(wǎng)址頁面,封裝成APK
一、下載 AndroidStudio
自行下載安裝,https://developer.android.google.cn/studio/#downloads
二、新建項(xiàng)目


三、配置項(xiàng)目
MainActivity
package com.lmm.myapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
webView = new WebView(this);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClientDiy(this));
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setAppCacheEnabled(true);
webView.loadUrl("http://www.sdyztech.com/");
setContentView(webView);
}
}
WebViewClient
package com.lmm.myapp;
import android.content.Context;
import android.webkit.WebViewClient;
public class WebViewClientDiy extends WebViewClient {
Context context;
public WebViewClientDiy(Context context){
this.context =context;
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lmm.myapp">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:roundIcon="@drawable/icon"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

到此這篇關(guān)于Android Studio打包H5網(wǎng)址頁面,封裝成APK的文章就介紹到這了,更多相關(guān)Android Studio封裝APK內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Android 完全退出當(dāng)前應(yīng)用程序的四種方法
Android程序有很多Activity,比如說主窗口A,調(diào)用了子窗口B,如果在B中直接finish(), 接下里顯示的是A。在B中如何關(guān)閉整個(gè)Android應(yīng)用程序呢?本人總結(jié)了幾種比較簡單的實(shí)現(xiàn)方法2016-02-02
Android 實(shí)現(xiàn)高斯模糊效果且兼容低版本
這篇文章主要介紹了Android 實(shí)現(xiàn)高斯模糊效果且兼容低版本的相關(guān)資料,本文圖文并茂介紹的非常詳細(xì),需要的朋友可以參考下2016-09-09
Android基于TextView不獲取焦點(diǎn)實(shí)現(xiàn)跑馬燈效果
這篇文章主要介紹了Android基于TextView不獲取焦點(diǎn)實(shí)現(xiàn)跑馬燈效果,結(jié)合實(shí)例形式分析了Android基于TextView實(shí)現(xiàn)跑馬燈的功能與布局相關(guān)技巧,需要的朋友可以參考下2017-02-02
Android實(shí)現(xiàn)在ServiceManager中加入自定義服務(wù)的方法詳解
這篇文章主要介紹了Android實(shí)現(xiàn)在ServiceManager中加入自定義服務(wù)的方法,結(jié)合實(shí)例形式分析了Android開發(fā)中ServiceManager自定義服務(wù)的相關(guān)創(chuàng)建與使用方法,需要的朋友可以參考下2017-08-08
android實(shí)現(xiàn)手機(jī)與單片機(jī)藍(lán)牙模塊通信
這篇文章主要為大家詳細(xì)介紹了android實(shí)現(xiàn)手機(jī)與單片機(jī)藍(lán)牙模塊通信的方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-05-05
Android入門之實(shí)現(xiàn)自定義Adapter
這篇文章主要為大家詳細(xì)介紹了Android如何實(shí)現(xiàn)自定義Adapter,文中的示例代碼講解詳細(xì),對(duì)我們學(xué)習(xí)Android有一定的幫助,需要的可以參考一下2022-11-11
Android提高Service優(yōu)先級(jí)的方法分析
這篇文章主要介紹了Android提高Service優(yōu)先級(jí)的方法,簡單講述了Service優(yōu)先級(jí)的功能,并對(duì)比分析了1.5與1.0設(shè)置Service的技巧,需要的朋友可以參考下2016-06-06

