简体   繁体   English

我的自适应网站无法在WebView中工作,但可以在Android浏览器中工作

[英]My responsive site doesn't work in WebView but does in Android browsers

Since I know very little about Java programming I'm probably in over my head but I'll be as specific as I can. 由于我对Java编程知之甚少,所以我可能会不知所措,但我会尽我所能。

My sites is responsive and works in chrome and the default android browser perfectly. 我的网站反应灵敏,可在chrome和默认的Android浏览器中完美运行。 I tried to wrap it in a WebView app while I scratched and clawed my way through learning Java correctly so I could write a decent app. 我试图通过正确学习Java的方式来抓取和抓取自己的方式时,尝试将其包装在WebView应用程序中,以便编写出不错的应用程序。

Elements on the responsive page don't display in the WebView app but do in browsers on my phone. 响应页面上的元素不会显示在WebView应用程序中,而是显示在手机的浏览器中。 So without further a due, here is the code and the URL: 因此,这里没有代码,下面是代码和URL:

www.dirtywasted.com user: stackoverflow pass: stackoverflow www.dirtywasted.com用户:stackoverflow通过:stackoverflow

package com.dirtywasted.dirtywasted;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;


public class MainActivity extends ActionBarActivity {

private WebView mWebView;

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

    mWebView = (WebView) findViewById(R.id.activity_main_webview);
    mWebView.loadUrl("http://www.dirtywasted.com/");
    // Stop local links and redirects from opening in browser instead of WebView
    mWebView.setWebViewClient(new MyAppWebViewClient());
}

}

I hope I've posted enough info.... 我希望我已经发布了足够的信息。

Thanks in advance for any help. 在此先感谢您的帮助。

Oh, and specifically I've noticed the place where ya update your status is disappearing and the button on the right that expands the menu doesn't nothing in the app.... I assume it's due to the same thing. 哦,特别是我注意到您更新您的状态的地方消失了,并且用于扩展菜单的右侧按钮在应用程序中什么都没有。...我认为这是由于同一原因。 Probably not allowing Java to run in the WebView. 可能不允许Java在WebView中运行。

Did you check your AndroidManifest.xml? 您是否检查过AndroidManifest.xml?

Add the INTERNET permission: 添加INTERNET权限:

<uses-permission android:name="android.permission.INTERNET" /> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM