小编Lew*_*ent的帖子

Android webview不会加载我的网址,但会加载其他网址

我在android上有一个webiew应用程序加载一些网站,但不是我需要的网站.

我不知道这是网站主机的问题还是我可以在我的应用中做的事情.基本上我有一个我正在为大学做的在线作品集,我希望通过将它构建成一个应用程序让自己看起来更好.投资组合网站包含一个移动版本,因此它已经为此设置,并且在我的手机上的Chrome浏览器中工作正常.

它曾经使用旧网站,它加载谷歌所以我知道我有互联网权限.不确定这是否与我的新网站有关,或者我只需要改变一些东西以使其有效.

在Chrome浏览器中它看起来应该是这样,目前还不好,因为我想在添加内容之前先做这件事.这是它的外观.(不能直接发布截图,因为我没有足够的代表,抱歉)

这是我的主要应用代码:

package com.broadbentstudios;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.parse.ParseAnalytics;

@SuppressLint("SetJavaScriptEnabled")
public class ParseStarterProjectActivity extends Activity {

    WebView webView;
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        webView = (WebView) findViewById(R.id.mainWebView);
        webView.setBackgroundColor(0x00000000);
        webView.setHorizontalScrollBarEnabled(false);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setUseWideViewPort(true);
        webView.loadUrl("http://www.broadbentstudios.com/");

        webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url)
            {
                view.loadUrl(url);
                return true;
            }                
        });
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent …
Run Code Online (Sandbox Code Playgroud)

android android-webview

11
推荐指数
1
解决办法
3万
查看次数

网站无法在android webview中加载,但可以在android浏览器中正常运行

这已经让我很烦了一段时间,我真的可以使用一些帮助。我有一个在Portfoliobox.net上创建的网站,该网站在chrome和我在android上尝试过的所有其他浏览器(实际的手机,而不是模拟器)都可以正常运行,但是我希望将其变成大学项目一部分的应用程序。我的webview应用程序可以正常加载其他网站,但由于某些原因不能正常运行,所以是的,我已设置权限,并且启用了JavaScript。可能很简单,但是我是一个主要菜鸟,没有太多的头绪。

这是logcat

04-30 22:08:56.954: W/BindingManager(8365): Cannot call determinedVisibility() - never saw a connection for the pid: 8365
04-30 22:08:56.962: E/com.parse.push(8365): successfully subscribed to the broadcast channel.
04-30 22:08:56.973: D/GCM(2579): COMPAT: Multi user ser=0 current=0
04-30 22:08:56.989: D/GCM(11959): GcmService start Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms cmp=com.google.android.gms/.gcm.GcmService (has extras) } com.google.android.c2dm.intent.REGISTER
04-30 22:08:57.145: I/Icing(2579): Indexing DBC59092704C7216FC04EAC8683F4EE7F5C1F3E0 from com.google.android.googlequicksearchbox
04-30 22:08:57.302: W/SQLiteConnectionPool(2579): A SQLiteConnection object for database '/data/data/com.google.android.gms/databases/auto_complete_suggestions.db' was leaked!  Please fix your application to end transactions in progress properly and to close the …
Run Code Online (Sandbox Code Playgroud)

javascript java android webview android-intent

1
推荐指数
1
解决办法
2853
查看次数