|-转 如何使用Android Studio将网站转换为Android App
In this tutorial you will learn how to convert website to android app using Android Studio.
在本教程中,您将学习如何使用Android Studio将网站转换为android应用。
Before reading this tutorial I hope that you already have basic knowledge of Android App Development. Otherwise you won’t be able to understand anything.
在阅读本教程之前,我希望您已经具有Android App Development的基本知识。 否则,您将无法理解任何内容。
What I will do here is simply open the website in webview with a loading bar so that it will look like we are using an android app.
我在这里要做的就是简单地在Webview中使用加载栏打开网站,以便看起来我们正在使用android应用。
By using this method you can convert website or wordpress blog into android application. You can follow this link to see an example app that I have created using this process.
通过使用此方法,您可以将网站或wordpress博客转换为android应用程序。 您可以点击此链接查看我使用此过程创建的示例应用程序。
Note: Make sure the website for which you want to create app is responsive, otherwise the app will not look proper.
注意:请确保您要为其创建应用程序的网站具有响应能力,否则该应用程序将无法正常显示。
If you want to integrate admob and google analytics in your app then you can follow below tutorials.
如果您想将admob和Google Analytics(分析)集成到您的应用中,则可以按照以下教程进行操作。
Also Read: Android Google Analytics Integration Tutorial
另请参阅: Android Google Analytics(分析)集成教程
Also Read: Android AdMob Tutorial
另请参阅: Android AdMob教程
如何将网站转换为Android App (How to Convert Website to Android App)
Create an android studio project with the website name.
使用网站名称创建一个android studio项目。
Add internet access permission to AndroidManifest.xml file.
将互联网访问权限添加到AndroidManifest.xml文件。
<uses-permission android:name="android.permission.INTERNET"/>
Add following code in activity_main.xml file. Here I have added a horizontal progress bar with a webview.
在activity_main.xml文件中添加以下代码。 在这里,我添加了带有Webview的水平进度条。
activity_main.xml
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.myudaipurcity.MainActivity">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="fill_parent"
android:layout_height="5dp"
android:progressDrawable="@drawable/bg_progress_bar_webview" />
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/progressBar"
/>
</RelativeLayout>">
Create an xml file inside drawable folder and add following code in it. It is a custom background for progress bar. You can change the color by changing color code in res/values/color.xml file....