2017-12-30 65 views
0

Hallo und Frohes neues Jahr!Machen Sie Platz für Anzeigen Höhe

Ich habe ein seltsames Problem mit der Bannerhöhe in meiner Aktivität.

Grundsätzlich sind die Anzeigen Abmessungen 320x50dp, aber in logcat kann ich sehen, es hat nur 320x0dp. Das ist offensichtlich bedeutet, dass es nicht genug Platz ist, Anzeigen Höhe zu laden, aber ich weiß nicht, wie sie zu beheben ...

Mein contant_main hier:

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

Jeder weiß, wie kann ich genug freimachen Platz im App-Layout, um mein Banner zu zeigen?

Dank

Antwort

0

Ihre Linearlayout am Boden unter dem Scrollview, das ist richtig, aber die Scrollhöhe ‚wrap_content‘, die es den ganzen Weg nach unten auf der Seite zu machen. einen Attribut

android:layout_alignParentBottom 

hinzufügen und es auf true gesetzt.

+0

innerhalb der Scrollview? – androidexpert35

Verwandte Themen