Android错误:W/ADS:没有足够的空间显示AD.需要320x50 dp,但只有384x0 dp



其他人也有这个问题,但是我的唯一(我认为)是因为此错误仅在我在应用程序中打开键盘时才发生。键盘未打开时不会发生。

再次,错误是:

W/Ads: Not enough space to show ad. Needs 320x50 dp, but only has 384x0 dp.

这是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"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<EditText
    android:id="@+id/input"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="Enter your Number"
    android:textAlignment="center"
    android:layout_gravity="center"
    android:inputType="text"
    android:ems="25"
    android:textColor="@color/colorPrimary"
    android:textSize="20sp"
    android:maxLength="31"
    android:layout_marginTop="30dp"
    android:layout_marginBottom="45dp"/>
<TextView
    android:id="@+id/from"
    android:text="@string/from"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:textColor="@color/colorPrimary"
    android:textSize="16sp" />
<Spinner
    android:id="@+id/spinner"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:entries="@array/spinner_entries1"
    android:background="@null"
    android:layout_marginBottom="25dp"/>
<TextView
    android:id="@+id/to"
    android:text="@string/to"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:textColor="@color/colorPrimary"
    android:textSize="16sp" />
<Spinner
    android:id="@+id/spinner2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:background="@null"
    android:cursorVisible="false"
    android:entries="@array/spinner_entries2"
    android:layout_marginBottom="20dp"/>
<EditText
    android:id="@+id/output"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAlignment="center"
    android:layout_gravity="center"
    android:inputType="text"
    android:ems="25"
    android:textColor="@color/colorPrimary"
    android:textSize="20sp"
    android:maxLength="31"
    android:layout_marginBottom="30dp" />
<Button
    android:id="@+id/button"
    android:text="@string/button_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@color/colorPrimary"
    android:textColor="#FFFFFF"
    android:onClick="convert"
    android:layout_gravity="center" />
<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    ads:adSize="BANNER"
    ads:adUnitId="@string/admob_id"
    android:layout_marginTop="50dp"
    />
</LinearLayout>

我该如何修复?

编辑:我不会打扰解决此问题,因为当键盘消失时,广告会返回正常,但是当键盘"触摸"视图时,视图闪烁。

通过添加

修复
 android:windowSoftInputMode="adjustPan"

AndroidManifest.xml下的 CC_1

在这里找到的答案

最新更新