2011-07-11 8 views
1

は具体的に私は、底部に向かって下方に浮くためのID bottomStuffでRelativeLayoutを取得しようとしています。私は他のSOの記事から示唆されている一番下に設定する重力を設定しようとしたが、それはまだ上部にあるすべての方法を貼り、これはなぜですか?なぜRelativeViewは一番下にないのですか?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
android:id="@+id/relativeLayout1" android:layout_width="fill_parent" 
android:layout_height="fill_parent" android:gravity="center"> 

<TextView android:id="@+id/textView1" android:textAppearance="?android:attr/textAppearanceLarge" 
    android:layout_alignParentRight="true" android:layout_weight="1" 
    android:layout_width="fill_parent" android:layout_height="wrap_content" 
    android:text="@string/currentAlarms" android:gravity="center" 
    android:layout_alignParentTop="true"> 
</TextView> 

<ScrollView android:id="@+id/scroll" android:layout_width="fill_parent" 
    android:layout_below="@+id/textView1" android:layout_centerVertical="true" 
    android:gravity="center" android:layout_height="wrap_content" 
    android:layout_marginBottom="150px"> 

    <LinearLayout android:layout_width="wrap_content" 
     android:id="@+id/alarms" android:orientation="vertical" 
     android:gravity="center" android:layout_centerVertical="true" 
     android:layout_height="wrap_content"> 
    </LinearLayout> 
</ScrollView> 

<RelativeLayout android:id="@+id/bottomStuff" 
android:layout_height="wrap_content" android:layout_width="fill_parent" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true" android:layout_marginBottom="12dp" 
    android:gravity="bottom"> 

<com.google.ads.AdView android:id="@+id/adView" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        ads:adUnitId="a14e1a859cbb3fb" 
        ads:adSize="BANNER" 
        ads:loadAdOnCreate="true"/> 

     <LinearLayout android:id="@+id/BLinearLayout" 
     android:layout_height="wrap_content" android:layout_width="fill_parent" 
     android:layout_below="@+id/adView" 
     android:layout_alignParentBottom="true" 
     android:layout_centerHorizontal="true" 
     android:gravity="bottom"> 

     <Button android:layout_height="wrap_content" android:text="@string/addAlarm" 
      android:id="@+id/button1" android:layout_width="0px" 
      android:layout_weight="1" android:drawableTop="@drawable/plus" 
      android:onClick="addAlarm"> 
     </Button> 
     <Button android:layout_width="0px" android:layout_height="wrap_content" 
      android:id="@+id/button2" android:layout_centerVertical="true" 
      android:layout_alignParentRight="true" android:layout_weight="1" 
      android:text="@string/settings" android:drawableTop="@drawable/preferences"> 
     </Button> 

    </LinearLayout> 
</RelativeLayout> 

</RelativeLayout> 

ありがとうございます!

答えて

2

を生成layout_alignParentBottomを削除する必要があります。

<LinearLayout android:id="@+id/BLinearLayout" 
     android:layout_height="wrap_content" android:layout_width="fill_parent" 
     android:layout_below="@+id/adView" 
     android:layout_centerHorizontal="true" 
     android:layout_gravity="bottom"> 
+0

それは、ありがとう! – Atrus

0

は重力にlayout_gravityを変更してみてください。

+0

のみダウン下にあるボタンをもたらした、広告自体はまだ反映させるために編集され、上にすべての方法をまま変化する。それはめちゃくちゃいない – Atrus

0

あなたのXMLを台無しにされて、私はあなたがきれいにやって試してみましたが、RelativeLayoutのための2つのオープンのタグだけが1に近いのタグを参照してください?その、ボタンであなたのLinearLayoutでエラー

+0

、それは貧しいコピー&ペーストスキルだ...変更を反映するように編集します。 – Atrus

関連する問題