2017-12-30 75 views
0

こんにちは、新しい年!広告のスペースを増やす

私のバナー広告の高さに問題があります。

広告のサイズは320x50dpですが、logcatでは320x0dpしか表示されません。 マイcontant_mainはここにある。これは明らかに、広告の高さをロードするための十分なスペースがないということを意味しますが、私は修正する方法がわからない...

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:ads="http://schemas.android.com/apk/res-auto". 
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" 
tools:context=".MainActivity" 
tools:showIn="@layout/activity_main"> 

<LinearLayout 
    android:id="@+id/aboutLinearLayout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:layout_gravity="center_horizontal" 
    android:weightSum="1"> 


    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="400dp" 
     android:layout_height="200dp" 
     android:layout_gravity="center_horizontal" 
     android:contentDescription="Header picture" 
     android:importantForAccessibility="no" 
     android:maxHeight="57dp" 
     android:maxWidth="57dp" 
     android:src="@drawable/xm" 
     android:layout_marginBottom="15dp"/> 
    </LinearLayout> 

    <ScrollView 
     android:id="@+id/scrollView" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_centerVertical="true" 
     android:layout_below="@id/aboutLinearLayout"> 

     <LinearLayout 
      android:id="@+id/aboutLinearLayout2" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" 
      android:layout_gravity="center_horizontal" 
      android:weightSum="1"> 

    // some Switches and textviews here that i can't show you 


</LinearLayout> 

</ScrollView> 

// Using this form to show ads becouse i don't want that it overrides scrollview when it's shown 

<LinearLayout 
    android:id="@+id/layoutadmob" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_centerVertical="true" 
    android:layout_below="@id/scrollView"> 

    <com.google.android.gms.ads.AdView 
     android:id="@+id/adView" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     ads:adSize="BANNER" 
     ads:adUnitId="@string/banner_ad_unit_id"> 
    </com.google.android.gms.ads.AdView> 

</LinearLayout></RelativeLayout> 

いずれかが、私は十分に解放することができます方法を知っています私のバナーを表示するアプリレイアウトのスペース?

おかげ

答えて

0

は底にあなたのLinearLayoutは右であるscrollView、下にあるが、ScrollViewの高さは、ページ内のすべての方法ダウンし、それを作る「wrap_content」です。 属性を追加する

android:layout_alignParentBottom 

これをtrueに設定します。

+0

スクロールビュー内にありますか? – androidexpert35

関連する問題