我的应用程序中有简单的布局xml文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/lay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="xxx" />
<RelativeLayout
android:id="@+id/searchTextLayout"
android:layout_width="match_parent"
android:layout_height="50dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="5dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="80dip"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/button1"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@null"
android:onClick="geoLocate"
android:scaleType="fitCenter"
android:src="@drawable/but" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_toRightOf="@id/button1"
android:background="@drawable/sback"
android:hint="Wprowadź swój adres"
android:padding="8dp"
android:textColor="@android:color/black" />
</RelativeLayout>
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="fill_parent" />
</LinearLayout>但是当我在日志猫中运行我的应用程序时,我得到了一个错误:“没有足够的空间显示广告。需要480x75,但是只有432x730”有人可以帮我解决这个大小问题吗?
发布于 2013-11-23 01:17:05
几乎可以肯定,这与您最外层的LinearLayout中的填充有关。
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"移除/减少。
发布于 2013-11-21 21:19:54
很难回答却没有看到镜头。如果我是你,并试图解决这个问题,我将从视图中移除大量内容,并继续重新引入部分视图,直到问题返回为止。然后,您将知道需要在视图中更改哪些内容。所以也许从这里开始重建
?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/lay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="xxx" />
</LinearLayout>还可以考虑使用dip单元来定义所有布局,而不是"match_parent“,直到找到问题为止。它会让你准确地知道每件事物之间的相互关系有多大。
希望这能帮点什么。
https://stackoverflow.com/questions/20131180
复制相似问题