2013-03-21 3 views
0

Я пытаюсь поместить мой google admob в нижней части экрана, но, похоже, он нажат. Я искал его, и его предложения должны быть переведены в relativelayout и привести его в соответствие с parentbottom. Я сделал это, но он, похоже, не работает. Является ли моя общая структура неправильной?Поместить relativelayout внизу

<?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> 

EDIT

<?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> 
+0

я думаю, что это должно работать андроид: layout_alignParentBottom = «истинный» –

+0

у меня есть это в моем

ответ

3

Дело в том, что ваш макет корень должен быть RelativeLayout, то вы можете установить ваш Баннера android:layout_alignParentBottom="true". Прямо сейчас AdView имеет родителя RelativeLayout, который все еще находится внутри LinearLayout. Надеюсь, это понятно.

+0

Конечно .. блин, стыдно: D –

+0

@ MatthiasVanb, Надеюсь, ваша проблема решена сейчас :) – Egor

+0

одна вещь, мой gridview теперь появляется за поддержкой google, любая идея, как это исправить? : s –

Смежные вопросы