【发布时间】:2014-02-07 22:05:44
【问题描述】:
这是我的 XML 布局代码,它给出了空间不足的错误。好像宽度不够大,我觉得非常奇怪。 没有足够的空间显示添加!希望 有 这是我在 logcat 中遇到的错误。
<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>
是的..请帮忙
【问题讨论】:
-
我尝试了 android:layout_width="wrap_content" 以及像其他对象一样移动得更高,但似乎没有任何改变错误数字。
-
也许问题出在RelativeLayout Padding上?