Android Studio:Webview - 底部的空白区域

时间:2015-11-14 22:12:42

标签: android android-studio webview

在我的应用中,底部有一个白色条。我已经查看了其他问题,他们告诉我确保将所有内容设置为match_parent。我做到了,没有任何效果。

照片: http://i.imgur.com/G3FlTij.png

任何帮助都将不胜感激。

fragment_main.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:id="@+id/container_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/container_swipe_refresh"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

        <WebView
            android:id="@+id/fragment_main_webview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/global_bg_front" />

    </android.support.v4.widget.SwipeRefreshLayout>

    <com.google.android.gms.ads.AdView
        android:id="@+id/fragment_main_adview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        app:adUnitId="@string/admob_unit_id"
        app:adSize="BANNER" />

</LinearLayout>

<include
    layout="@layout/placeholder_progress"
    android:id="@+id/container_progress"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="gone" />

<include
    layout="@layout/placeholder_offline"
    android:id="@+id/container_offline"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="gone" />

<include
    layout="@layout/placeholder_empty"
    android:id="@+id/container_empty"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="gone" />

activity_main.xml中

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

<include layout="@layout/toolbar" />

<android.support.v4.widget.DrawerLayout
    android:id="@+id/activity_main_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

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

    <ListView
        android:id="@+id/activity_main_drawer"
        android:layout_width="@dimen/drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:drawSelectorOnTop="true"
        android:fastScrollEnabled="false"
        android:listSelector="@drawable/selector_clickable_item_bg"
        android:background="@color/global_bg_front" />

</android.support.v4.widget.DrawerLayout>

1 个答案:

答案 0 :(得分:1)

这个栏是不是因为布局中显示的广告错误?你有没有尝试删除它?如果栏消失,则表示展示广告时出现问题。

<com.google.android.gms.ads.AdView
    android:id="@+id/fragment_main_adview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    app:adUnitId="@string/admob_unit_id"
    app:adSize="BANNER" />
相关问题