如何将网站包装在手机应用程序中?

新手上路,请多包涵

我见过很多手机应用程序只是打开一个网页而没有控件。只是页面。

我正在寻找指导和链接来开始像这样简单的事情。

原文由 EnexoOnoma 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 331
2 个回答

如果我理解您的要求,在 Windows Phone 7 上,您无法在 Microsoft Marketplace 中批准此类应用程序。 Windows Phone 的应用程序认证要求 第 2.10 节说:“您的应用程序必须具有独特、实质和合法的内容和目的。您的应用程序必须提供启动网页以外的功能。”

我的一个同事最近有一个类似风格的申请被苹果公司拒绝了,就是因为这个原因。

我认为在这两个平台上,您过去可能已经能够接受这些类型的应用程序,但现在不会了。

原文由 Visual Stuart 发布,翻译遵循 CC BY-SA 3.0 许可协议

如果您想在 Android 中包装一个网站,您可以使用来自 Roskvist 的代码

package com.webview;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebView;

public class WebViewTest extends Activity {

    WebView browserView;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //Removes the title bar in the application
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.main);

        //Creation of the Webview found in the XML Layout file
        browserView = (WebView)findViewById(R.id.webkit);

        //Enable Javascripts
        browserView.getSettings().setJavaScriptEnabled(true);

        //Removes both vertical and horizontal scroll bars
        browserView.setVerticalScrollBarEnabled(false);
        browserView.setHorizontalScrollBarEnabled(false);

        //The website which is wrapped to the webview
        browserView.loadUrl("http://dev.openlayers.org/sandbox/camptocamp
        /mobile/trunk/examples/iol-iui.html?rev=9962#_map");

    }
}

这是 main.xml 的内容

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<WebView
    android:id = "@+id/webkit"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"

    />
</RelativeLayout>

然后您必须编译它并通过 USB 将其加载到您的设备。

原文由 Sandwich 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题