2013-02-05 19 views
1

我在我的本地应用程序中渲染webview时很困难,我粘贴了一些屏幕截图,其中显示了webview在每次宽度变化时的行为方式。Android Web查看获取拉伸布局宽度变化

而且我使用抽屉式菜单,方便向右每次我打开菜单抽屉

SCREEN照片时的WebView加载网页流量举动

enter image description here

到目前为止似乎是罚款,但现在当我打开并关闭抽屉菜单,它不会将其宽度恢复为100%并保持在50%

打开和关闭抽屉菜单

enter image description here

这也模糊了的WebView当我打开抽屉菜单

截屏WHEN抽屉菜单打开

enter image description here

我也曾尝试的WebView但没有一些不同的设置也在这里去我的webview java代码

JAVA代码

    mWebView = (WebView) findViewById(R.id.webView1); 
      mWebView.getSettings().setJavaScriptEnabled(true); 
      mWebView.getSettings().setSupportZoom(false); 
      mWebView.getSettings().setBuiltInZoomControls(false); 
      // Load URL 
      mWebView.loadUrl(requestUrl); 
+0

这是一个物理设备上?还是一个模拟器? –

+0

物理设备 –

+0

您使用哪个库作为抽屉/侧面导航菜单? –

回答

1

Following our discussion,看来问题是与android-menudrawer库有关。具体而言,硬件加速小部件在抽屉打开后无法正确显示,也如this issue concerning MapView v2所述。

我发现:

最基本的解决方案是通过在舱单android:hardwareAccelerated="false"禁用硬件加速,但我会鼓励你去探索更好的解决方案,如this one由上述问题笔者建议一个简单的黑客攻击。

您只需创建具有内容占位符和始终可见的透明覆盖图的RelativeLayout。里面 内容每次点击的事件工作正常和错误也消失了:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 

    <FrameLayout 
      android:id="@+id/fragment_placeholder" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 

    <FrameLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@android:color/transparent" /> 

</RelativeLayout> 
+0

显示黑客的线程似乎不是工作,但正如你所提到的设置hardwareAccelerated为false似乎是有希望的,因为它一路运行良好......谢谢 –