web视图显示黑屏 [英] Webview shows blank screen

查看:372
本文介绍了web视图显示黑屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题可能是多余的,但我已经尝试了多种解决方案,并没有什么可帮助我。
在我的应用程序,一旦用户点击一个按钮,它的用户到另一个页面传输。在这个页面我有一个web视图和一个按钮。它们在我的xml文件中定义如下:

I know the question may be redundant but I've tried many solutions and nothing could have helped me. In my app, once the user is clicking on a button, it transfers the user to another page. On this page I have a Webview, and a button. They are defined in my xml file as follows:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight="1" >

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="right"
    android:text="Log out"
    android:id="@+id/btLogot" />

    <WebView 
        android:layout_width="fill_parent"
        android:layout_height="0px"
        android:layout_weight="3"
        android:id="@+id/webView"
         />

</LinearLayout> 

在另一方面,我已经使用 WebViewClient() shouldOverrideUrlLoading覆盖它()
问题是,什么也不会发生。
我想我的code是好的,但有一些问题我的我的布局XML和重量。

In the other hand, I have used WebViewClient() and override it with shouldOverrideUrlLoading(). The problem is, nothing happens. I think my code is alright, but there's something wrong with my xml and weight of my layouts.

那么,有什么事?!

推荐答案

layout_weight 3 和而在 layout_weight 按钮没有定义。此外,您应该删除 layout_weight 的LinearLayout (如果你彪重量总和,它不是强制性反正)

your layout_weight is 3 and the while the layout_weight of the button is not defined. Moreover you should remove layout_weight of the LinearLayout ( if you ment weight sum, it's not compulsory anyway)

这篇关于web视图显示黑屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆