【问题标题】:How to make a web app for android?如何为android制作一个网络应用程序?
【发布时间】:2012-03-04 18:29:20
【问题描述】:

我制作 Android 应用程序已经有 4-5 天了。所以我想知道你是否知道我如何制作一个网络应用程序?我一直在浏览许多教程,但没有一个直接显示我如何制作一个显示网站内容的应用程序,并且我可以决定我想要和不想显示什么。所以我真的只是想将一个网站定制成一个应用程序并制作我自己的布局。我知道 WebView 和 WebContent 是如何工作的以及所有这些东西,但我不知道我该如何做我在这里描述的事情。

那么我需要学习和了解什么才能制作这样的应用程序?

【问题讨论】:

  • 你看过PhoneGap吗? phonegap.com/start#android
  • 还是一个简单的带有 WebView 的 Activity?
  • 没有。我没有看过PhoneGap。但是我可以使用 PhoneGap 自定义我的 WebView 吗?这很难吗?

标签: android webview web-applications webcontent


【解决方案1】:

你可以用 EdidText 填充你的 xml 布局,用 EdidText 作为 url 和 Buttons 用于 Go、后退、前进等,最后你需要在这个 xml 布局中使用 webview。

对于 java 代码,您可以查看以下示例。

public class SimpleBrowser extends Activity implements OnClickListener {


    WebView myBrowser;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.simplebrowser);

//here the code for initialize and set yourwebView Settings.
        myBrowser= (WebView) findViewById(R.id.wvBrowser);

//the below line to enable javascript if you want that
        myBrowser.getSettings().setJavaScriptEnabled(true);

//here another settings could be enabled for you your webview
        myBrowser.getSettings().setLoadWithOverviewMode(true);
        myBrowser.getSettings().setUseWideViewPort(true);

        try {
//here the default web page
            ourBrow.loadUrl("http://www.google.com");
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}

当然,您需要使用 onClicklistener 实现按钮以适合您的想法。

https://www.youtube.com/watch?v=lkadcYQ6SuY&index=89&list=PL2F07DBCDCC01493A https://www.youtube.com/watch?v=PQ94MmEg0Qw&index=90&list=PL2F07DBCDCC01493A

【讨论】:

    猜你喜欢
    • 2010-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-16
    相关资源
    最近更新 更多