2017-09-05 4 views
0

私はadmob、3 textviewsとadmobを持っています。この最後の1つは私の活動の最中に置いておきたいものです。これは最後のテキストビューの後です。私は下にadmobを入れるために何を変えるべきですか? (いない最後のTextView後)android:layout_alignParentBottom = "true"は下にadmobを追加していません

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/ScrollView01" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/ad_view" 
      android:layout_marginBottom="0dp" 
      android:layout_marginEnd="0dp" 
      android:layout_marginLeft="0dp" 
      android:layout_marginRight="0dp" 
      android:layout_marginStart="0dp" 
      android:layout_marginTop="0dp" 
      android:orientation="horizontal"> 

      <com.google.android.gms.ads.AdView 
       xmlns:ads="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/adView" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:layout_alignParentBottom="true" 
       ads:adSize="SMART_BANNER" 
       ads:adUnitId="ca-app-pub-1234567"> 
      </com.google.android.gms.ads.AdView> 

     </LinearLayout> 


     <TextView 
      android:id="@+id/howTo1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/ad_view" 
      android:layout_marginTop="10dp" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp" 
      android:onClick="onClick" 
      android:clickable="true" 
      android:text="1) Steep 1" /> 

     <TextView 
      android:id="@+id/howTo2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/howTo1" 
      android:layout_marginTop="10dp" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp" 
      android:onClick="onClick" 
      android:clickable="true" 
      android:text="2) Steep 2" /> 

     <TextView 
      android:id="@+id/howTo3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/howTo2" 
      android:layout_marginTop="10dp" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp" 
      android:onClick="onClick" 
      android:clickable="true" 
      android:text="3) Steep 3" /> 



     <com.google.android.gms.ads.AdView 
      xmlns:ads="http://schemas.android.com/apk/res-auto" 
      android:id="@+id/adView2" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      ads:adSize="SMART_BANNER" 
      android:layout_alignParentBottom="true" 
      ads:adUnitId="ca-app-pub-1234567"> 
     </com.google.android.gms.ads.AdView> 


    </RelativeLayout> 
</ScrollView> 

alignParentBottomが機能しない理由?アドミニストレーターは最後のテキストビューの後ろが底にないのですか?

+1

はscrollviewの外にadviewをお試しください。相対レイアウトを親レイアウトにする。 – Reena

+0

@Reenaスクロールビューなしで動作します。 –

答えて

1

コード行下にしてみ

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <ScrollView 
     android:id="@+id/ScrollView01" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/ad_view" 
       android:layout_marginBottom="0dp" 
       android:layout_marginEnd="0dp" 
       android:layout_marginLeft="0dp" 
       android:layout_marginRight="0dp" 
       android:layout_marginStart="0dp" 
       android:layout_marginTop="0dp" 
       android:orientation="horizontal"> 

       <com.google.android.gms.ads.AdView 
        xmlns:ads="http://schemas.android.com/apk/res-auto" 
        android:id="@+id/adView" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_centerHorizontal="true" 
        android:layout_alignParentBottom="true" 
        ads:adSize="SMART_BANNER" 
        ads:adUnitId="ca-app-pub-1234567"> 
       </com.google.android.gms.ads.AdView> 

      </LinearLayout> 


      <TextView 
       android:id="@+id/howTo1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/ad_view" 
       android:layout_marginTop="10dp" 
       android:layout_marginLeft="10dp" 
       android:layout_marginRight="10dp" 
       android:onClick="onClick" 
       android:clickable="true" 
       android:text="1) Steep 1" /> 

      <TextView 
       android:id="@+id/howTo2" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/howTo1" 
       android:layout_marginTop="10dp" 
       android:layout_marginLeft="10dp" 
       android:layout_marginRight="10dp" 
       android:onClick="onClick" 
       android:clickable="true" 
       android:text="2) Steep 2" /> 

      <TextView 
       android:id="@+id/howTo3" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/howTo2" 
       android:layout_marginTop="10dp" 
       android:layout_marginLeft="10dp" 
       android:layout_marginRight="10dp" 
       android:onClick="onClick" 
       android:clickable="true" 
       android:text="3) Steep 3" /> 



     </RelativeLayout> 
    </ScrollView> 

    <com.google.android.gms.ads.AdView 
     xmlns:ads="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/adView2" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="10dp" 
     ads:adSize="SMART_BANNER" 
     android:layout_alignParentBottom="true" 
     ads:adUnitId="ca-app-pub-1234567"> 
    </com.google.android.gms.ads.AdView> 
</RelativeLayout> 
+0

それは完璧です!ありがとうございます –

+0

答えを受け入れる:) – Reena

1

相対レイアウトの高さをwrap_contentに設定するので、 をmatch_parentに変更する必要があります。

+0

ありがとうございました!私はそれを変更しましたが、今xmlに関する警告があります:この相対はwrap_contentを使うべきです。それは底にありません:( –

関連する問題