在为Android的应用程序结束语HTML [英] Wrapping HTML in an app for Android
问题描述
我有一个现有的网站(社会性),它已经具备了移动网络版本太多,所以我基本上想要做的是总结了查看一个Android应用程序,也许添加一个漂亮的启动画面吧。因此,本质上是一个品牌的浏览器窗口。
I have an existing site (social in nature) and it already has a mobile web version too, so what I basically want to do is wrap that view in an Android app and maybe add a nice splash screen to it. So essentially a "branded" browser window.
任何意见将是AP preciated。
Any advice would be appreciated.
推荐答案
您需要两个activites
You would need two activites
- 开机画面(使用定时器和X秒后移动到下一个活动)
- 主要
在主要活动中,您将需要设置一个布局与 web视图的所以是这样的:
In the main activity you would need to set a layout with a webView in your layout so something like:
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
和code:
and the code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.com");
}
和权限:
<uses-permission android:name="android.permission.INTERNET" />
在清单文件。
如果你想打开标题栏关闭您还需要添加:
If you want to turn the title bar off you will also need to add:
<activity android:name=".Main" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
阅读文档更多的帮助!这对谷歌的一个例子正是我引用的是<一个href="http://developer.android.com/resources/tutorials/views/hello-webview.html">http://developer.android.com/resources/tutorials/views/hello-webview.html
这篇关于在为Android的应用程序结束语HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!