简体   繁体   English

当我在Android应用程序中嵌入网站(wordpress博客)时,它是否在另一个浏览器中打开?

[英]When I Embed a website (wordpress blog) on my android app it opens in another browser?

I just start android developing and I want to embed my website in the app. 我刚刚开始进行android开发,我想将我的网站嵌入到应用程序中。 When I want to open " http://www.google.com " , webpage opens in My app, but when I change address to my blog it wants to open it on external browser. 当我想打开“ http://www.google.com ”时,网页会在我的应用程序中打开,但是当我将地址更改为博客时,它想在外部浏览器上打开它。 This is My activity code that I used to embed my site! 这是我用来嵌入网站的活动代码!

public class WebPage extends Activity {

  @SuppressLint("SetJavaScriptEnabled") @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_web_page);


    //web view start
    WebView med = (WebView) findViewById(R.id.webView1);
    med.getSettings().setJavaScriptEnabled(true);
    med.getSettings().
    med.loadUrl("http://www.mediratour.com");
  }
}

My webpage based on wordpress, I don't know if I have to change settings to prevent using external browser and opens it in My app. 我的网页基于wordpress,我不知道是否需要更改设置以防止使用外部浏览器并在“我的应用”中打开它。

Thanks 谢谢

    // Set this on your web view.
webView.setWebViewClient(new WebClient());

// Create this class.
public class WebClient extends WebViewClient {

    @Override
    public boolean shouldOverrideUrlLoading(final WebView webView, final String url) {
        webView.loadUrl(url);

        return true;
    }
}

I think it helps. 我认为这会有所帮助。

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

相关问题 我的应用程序上的Finish()打开另一个应用程序(ANDROID) - Finish() on my app opens another application (ANDROID) 如何在我的应用中嵌入网站 - How can I embed a website in my app 点击广告会打开浏览器,但是我无法返回到Android应用程序的启动活动屏幕 - Clicking on an ad opens a browser, but I cannot go back to the launching activity screen of my Android app 如何使我的WordPress博客为访问者提供安装Android应用程序的功能? - How to make my WordPress blog to offer visitors to install an Android app? 单击页面后,它将在浏览器中打开。 我想要在应用程式中 - When clicked to a page it opens in the browser. I want it in the app 如何将网站嵌入Android应用程序? - How to embed a website into an Android App? 如何在 Android 浏览器中创建我网站的链接启动我的应用程序但当链接有某个部分时不启动 - How to make a the links of my website in the Android browser start up my app but not when the link has a Certain part Android Studio web 应用程序打开 Wordpress 网站的空白页面。 怎么修? - Android Studio web app opens a blank page for Wordpress website. How to fix? 我可以在android应用程序的webview中嵌入自己的网站吗? - Can I embed my own website in webview of android application? 网站以android应用程序打开,但无法交互 - Website opens as android app, but cannot interact
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM