Android 隐藏广告时导航抽屉不显示

Android 隐藏广告时导航抽屉不显示,android,android-layout,admob,navigation-drawer,Android,Android Layout,Admob,Navigation Drawer,我有一个android应用程序,带有导航抽屉(侧边栏)和主活动xml布局上的广告。我在活动中有一个广播接收器,可以监听互联网连接的变化。如果internet连接良好,则我会使adView可见,但如果internet连接失败,我会将adView的可见性更改为“消失” 问题是,当我将adView的可见性更改为GONE时,由于某些奇怪的原因导航抽屉将无法打开。只有当我在adView的可见性设置为GONE的情况下关闭导航抽屉时,我才能快速看到它正在关闭。。。但是当我打开它时,我看不到它是打开的。它似乎已

我有一个android应用程序,带有导航抽屉(侧边栏)和主活动xml布局上的广告。我在活动中有一个广播接收器,可以监听互联网连接的变化。如果internet连接良好,则我会使adView可见,但如果internet连接失败,我会将adView的可见性更改为“消失”

问题是,当我将adView的可见性更改为GONE时,由于某些奇怪的原因导航抽屉将无法打开。只有当我在adView的可见性设置为GONE的情况下关闭导航抽屉时,我才能快速看到它正在关闭。。。但是当我打开它时,我看不到它是打开的。它似乎已打开,但不可见。如果我重新打开wifi,adView就会显示,问题就不存在了。如果关闭wifi或数据连接,我能让广告完全消失,那就太好了

我的xml文件

<?xml version="1.0" encoding="utf-8"?>

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.packagename"
tools:ignore="MergeRootFrame">

<RelativeLayout 
android:id = "@+id/activity_relative"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout 
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_above = "@+id/adView"/>

<com.google.android.gms.ads.AdView 
                     android:id="@+id/adView"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_alignParentBottom="true"
                     android:layout_centerHorizontal="true"
                     android:background="@color/Blue"
                     ads:adSize="SMART_BANNER"
                     ads:adUnitId="xxx-xx-xxxx"/>

</RelativeLayout>

<!-- The navigation drawer -->
<ListView 
    android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="@color/transparent"
    android:dividerHeight="0dip"
    android:background="@color/LightGrey"/>

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