Android 没有足够的空间显示广告
下面是我的XML布局代码,它给出了空间不足的错误。好像宽度不够大,我觉得非常奇怪。 没有足够的空间显示添加!这是我在日志中得到的错误Android 没有足够的空间显示广告,android,xml,layout,admob,Android,Xml,Layout,Admob,下面是我的XML布局代码,它给出了空间不足的错误。好像宽度不够大,我觉得非常奇怪。 没有足够的空间显示添加!这是我在日志中得到的错误 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:ads="http://schemas.android.com/apk/lib/com.google.a
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/backgr2"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:textColor="#fff"
android:text="Some Text" />
Maybe this gridview takes too much of the screen?
<GridView
android:id="@+id/gridView1"
android:layout_below="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="131dp"
android:background="@drawable/bakgr"
android:gravity="center"
android:horizontalSpacing="0dp"
android:numColumns="3"
android:verticalSpacing="5dp" >
</GridView>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/gridView1"
android:textSize="20sp"
android:textStyle="italic"
android:text="Some Text" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView2"
/>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/gridView1"
android:layout_marginBottom="40dp"
android:background="@drawable/button_state"
/>
This is the adview which cannot be displayed for I dont know what reason!
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adUnitId="XXXX"
ads:testDevice="TEST_EMULATOR"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"/>
</RelativeLayout>
也许这个gridview占据了太多的屏幕?
这是由于我不知道什么原因而无法显示的警告!
嗯。。请帮助问题在于根元素中指定的RelativeLayout填充。它也会影响AdView,这就是您出现此错误的原因
将填充专门移动到需要它的元素,或将这些元素包装在额外的线性布局中,并为其提供所需的填充。问题在于根元素中指定的RelativeLayout填充。它也会影响AdView,这就是您出现此错误的原因
将填充物专门移动到需要的元素,或将这些元素包装在附加的线性布局中,并为其提供所需的填充物。它是RelativeLayout的左右填充物。
去掉它,它就会起作用。它是相对线的左右填充。 移除它,它就会工作。只需移除即可
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
从相对布局中,您的问题得到解决只需删除
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
通过相对布局,您的问题得到解决我尝试了android:layout\u width=“wrap\u content”以及将其他对象移动到更高的位置,但似乎没有改变错误号。可能问题在于相对布局填充?我尝试了android:layout\u width=“wrap\u content”以及将其他对象移动到更高的位置,但似乎没有改变错误号。也许问题在于相对长度填充?