我尝试将我的 google admob 放在屏幕底部,但它似乎被推了。我搜索了它,建议将它放在相对布局中并将其与 parentbottom 对齐。我这样做了,但它似乎不起作用..我的总体结构错了吗?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/backrepeat"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="35dp"
android:background="#25ab89"
android:orientation="horizontal"
android:weightSum="4" >
<LinearLayout
android:id="@+id/linearBack"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:clickable="true"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="@+id/ivBackButton"
android:layout_width="18dp"
android:layout_height="18dp"
android:src="@drawable/arrow" />
</LinearLayout>
<TextView
android:id="@+id/tvScoreBoard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="2"
android:gravity="center"
android:text="level"
android:textColor="#ffffff"
android:textSize="18dp" />
<LinearLayout
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical"
android:paddingRight="2dp" >
<TextView
android:id="@+id/tvScoreInfoOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="0/30"
android:textColor="#ffffff"
android:textSize="12dp" />
<TextView
android:id="@+id/tvScoreInfoTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="score:"
android:textColor="#ffffff"
android:textSize="12dp" >
</TextView>
</LinearLayout>
</LinearLayout>
<GridView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="5dp"
android:background="@drawable/backrepeat"
android:columnWidth="100dp"
android:gravity="center"
android:horizontalSpacing="2dp"
android:listSelector="@null"
android:numColumns="4"
android:stretchMode="columnWidth"
android:verticalSpacing="2dp" >
</GridView>
<RelativeLayout xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="320dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_marginTop="6dp"
ads:adSize="BANNER"
ads:adUnitId="a150be111791eae"
ads:loadAdOnCreate="true" />
</RelativeLayout>
</LinearLayout>
编辑
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/backrepeat"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="35dp"
android:background="#25ab89"
android:orientation="horizontal"
android:weightSum="4"
android:id="@+id/llOneTop">
<LinearLayout
android:id="@+id/linearBack"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:clickable="true"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="@+id/ivBackButton"
android:layout_width="18dp"
android:layout_height="18dp"
android:src="@drawable/arrow" />
</LinearLayout>
<TextView
android:id="@+id/tvScoreBoard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="2"
android:gravity="center"
android:text="level"
android:textColor="#ffffff"
android:textSize="18dp" />
<LinearLayout
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical"
android:paddingRight="2dp" >
<TextView
android:id="@+id/tvScoreInfoOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="0/30"
android:textColor="#ffffff"
android:textSize="12dp" />
<TextView
android:id="@+id/tvScoreInfoTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="score:"
android:textColor="#ffffff"
android:textSize="12dp" >
</TextView>
</LinearLayout>
</LinearLayout>
<GridView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridView1"
android:layout_below="@+id/llOneTop"
android:layout_above="@+id/InnerRelativeLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="5dp"
android:background="@drawable/backrepeat"
android:columnWidth="100dp"
android:gravity="center"
android:horizontalSpacing="2dp"
android:listSelector="@null"
android:numColumns="4"
android:stretchMode="columnWidth"
android:verticalSpacing="2dp" >
</GridView>
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content">
<com.google.ads.AdView xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/adView"
android:layout_width="320dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_marginTop="6dp"
ads:adSize="BANNER"
ads:adUnitId="a150be111791eae"
ads:loadAdOnCreate="true" />
</RelativeLayout>
</RelativeLayout>