<tfoot id='9rG85'></tfoot>
<i id='9rG85'><tr id='9rG85'><dt id='9rG85'><q id='9rG85'><span id='9rG85'><b id='9rG85'><form id='9rG85'><ins id='9rG85'></ins><ul id='9rG85'></ul><sub id='9rG85'></sub></form><legend id='9rG85'></legend><bdo id='9rG85'><pre id='9rG85'><center id='9rG85'></center></pre></bdo></b><th id='9rG85'></th></span></q></dt></tr></i><div id='9rG85'><tfoot id='9rG85'></tfoot><dl id='9rG85'><fieldset id='9rG85'></fieldset></dl></div>

  • <small id='9rG85'></small><noframes id='9rG85'>

    <legend id='9rG85'><style id='9rG85'><dir id='9rG85'><q id='9rG85'></q></dir></style></legend>

      • <bdo id='9rG85'></bdo><ul id='9rG85'></ul>

      1. 在当前 web 视图中打开弹出/外部站点链接

        Open pop up/external site link in current webview(在当前 web 视图中打开弹出/外部站点链接)
        <tfoot id='IxWPS'></tfoot>
          <bdo id='IxWPS'></bdo><ul id='IxWPS'></ul>

        • <i id='IxWPS'><tr id='IxWPS'><dt id='IxWPS'><q id='IxWPS'><span id='IxWPS'><b id='IxWPS'><form id='IxWPS'><ins id='IxWPS'></ins><ul id='IxWPS'></ul><sub id='IxWPS'></sub></form><legend id='IxWPS'></legend><bdo id='IxWPS'><pre id='IxWPS'><center id='IxWPS'></center></pre></bdo></b><th id='IxWPS'></th></span></q></dt></tr></i><div id='IxWPS'><tfoot id='IxWPS'></tfoot><dl id='IxWPS'><fieldset id='IxWPS'></fieldset></dl></div>
          • <small id='IxWPS'></small><noframes id='IxWPS'>

              <tbody id='IxWPS'></tbody>

              <legend id='IxWPS'><style id='IxWPS'><dir id='IxWPS'><q id='IxWPS'></q></dir></style></legend>
                  本文介绍了在当前 web 视图中打开弹出/外部站点链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我目前正在编写一个 webview,它首先加载一个 twitter 页面(比如,NHL, http://twitter.com/nhl)如您所见,您可以找到 NHL 的推文,并且每条 NHL 推文都有另一个供用户点击的链接,例如bit.ly/ujcNZo

                  I am currently writing a webview, it first loads a twitter page (say, NHL, http://twitter.com/nhl) as you can see, you can find the tweet for NHL, and each NHL tweet has another link for user to click, e.g. bit.ly/ujcNZo

                  在我的网络视图中,如果我单击该链接(即 bit.ly/ujcNZo),我的网络视图,1 秒后,除了一个白色的 twitter 图标,什么都不显示颜色背景,它应该加载内容但它没有.

                  in my webview, if i click that link (i.e. bit.ly/ujcNZo), my webview, after 1 second, doesn't display anything but a twitter icon on a white color background, it should load the content but it didn't.

                  经过一段时间的调查,我认为这与事实有关推文中的链接(即 bit.ly/ujcNZo)实际上打开了链接在单独的窗口(弹出?)而不是当前页面链接已发布,我通过访问 NHL 的推特页面验证了这一点我的笔记本电脑上的浏览器.

                  after some time of investigation, i think it has to do with the fact that the link in the tweet (i.e. bit.ly/ujcNZo) actually opens the link in a separate window (pop up?) and not the current page where the link is posted, i verified this by going to NHL's twitter page on a browser in my laptop.

                  我的问题是,1. 有没有办法可以加载外部链接的内容 (bit.ly/ujcNZo,例如)在我当前的 web 视图中?

                  My Question is, 1. is there a way i can load the content of the external link (bit.ly/ ujcNZo, for instance) in my current webview?

                  推荐答案

                  你可以通过 WebViewClient 类来控制这个.只需扩展它并覆盖默认实现即可获得所需的配置,然后将其设置为当前 webview 的客户端.

                  You can control this through the WebViewClient class. Simply extend it and override the default implementation to get the desired configuration then set it as the client for your current webview.

                  活动

                  public void onCreate(Bundle savedInstanceState) {
                      super.onCreate(savedInstanceState);
                  
                              // set the webViewClient to a new instance of your custom WebViewClient
                  
                      webview.setWebViewClient(new WebActivityClient( this ));
                  
                  }
                  

                  自定义客户端

                  /** WebViewClient class for WebView in WebActivity */
                  private class WebActivityClient extends WebViewClient {
                  
                      public static final String TAG = "WebActivityClient";
                      private Context context;
                  
                      /** Constructor used to grab the context */
                      public WebActivityClient( Context context ) {
                          this.context = context;
                      }
                  
                      /** Override to load every link within the page inside this webview instead of using
                       * android's default application
                       * #7 http://developer.android.com/resources/tutorials/views/hello-webview.html */
                      @Override
                      public boolean shouldOverrideUrlLoading( WebView view, String url ) {
                          view.loadUrl(url);
                          return true;
                      }
                  
                  }
                  

                  希望这会有所帮助!

                  这篇关于在当前 web 视图中打开弹出/外部站点链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
                  SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
                  Android file copy(安卓文件拷贝)
                  Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)
                  Android copy image from gallery folder onto SD Card alternative folder(Android将图像从图库文件夹复制到SD卡替代文件夹)
                  Is there a tool to find unused resources in an Android project?(是否有工具可以在 Android 项目中查找未使用的资源?)

                    <i id='zJq8l'><tr id='zJq8l'><dt id='zJq8l'><q id='zJq8l'><span id='zJq8l'><b id='zJq8l'><form id='zJq8l'><ins id='zJq8l'></ins><ul id='zJq8l'></ul><sub id='zJq8l'></sub></form><legend id='zJq8l'></legend><bdo id='zJq8l'><pre id='zJq8l'><center id='zJq8l'></center></pre></bdo></b><th id='zJq8l'></th></span></q></dt></tr></i><div id='zJq8l'><tfoot id='zJq8l'></tfoot><dl id='zJq8l'><fieldset id='zJq8l'></fieldset></dl></div>

                          <tbody id='zJq8l'></tbody>
                      • <small id='zJq8l'></small><noframes id='zJq8l'>

                            <bdo id='zJq8l'></bdo><ul id='zJq8l'></ul>

                            <tfoot id='zJq8l'></tfoot>
                          • <legend id='zJq8l'><style id='zJq8l'><dir id='zJq8l'><q id='zJq8l'></q></dir></style></legend>