2016-05-31 145 views
0

我已經嘗試了一切(admob教程,GitHub克隆,YouTube教程等)。它不會顯示在任何設備(手機或平板電腦)和模擬器上。如果有人能給我一些指導,我會很感激。安卓admob橫幅將不會顯示

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:ads="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:orientation="vertical"> <FrameLayout 
    android:layout_width="match_parent" 
    android:layout_height="192dp" 
    android:background="@drawable/listback1" 
    android:alpha="0.8" 
    android:orientation="vertical"> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom" 
     android:paddingLeft="16dp" 
     android:paddingBottom="5dp" 
     android:gravity="right" 
     android:textColor="@color/orange" 
     style="@style/TextAppearance.AppCompat.Title" 
     android:text="Food For Thought" 
     android:elegantTextHeight="true" 
     /> </FrameLayout> 

<android.support.v7.widget.Toolbar 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    android:background="@drawable/textsign" 
    android:id="@+id/toolbar" 
    app:menu="@menu/menu_main" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    app:title="Choose Your Dining Experiance"/> 

<ExpandableListView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/expandableListView" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:divider="@color/orange" 
    android:textColor="#000000" 
    android:dividerHeight="1dp" 
    android:layout_marginTop="20dp" /> 



    <com.google.android.gms.ads.AdView 
     android:id="@+id/ad_view" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_alignParentBottom="true" 
     android:paddingTop="15dp" 
     ads:adSize="BANNER" 
     android:layout_below="@id/expandableListView" 
     android:layout_weight="1" 
     ads:adUnitId="@string/banner_ad_unit_id" /> 


    </LinearLayout> 


活動

@Override 
protected void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
setContentView(R.layout.expandable_layout); 



AdView mAdView = (AdView) findViewById(R.id.ad_view); 
AdRequest adRequest = new AdRequest.Builder().build(); 
mAdView.loadAd(adRequest);} 

gradle這個

 compile 'com.google.android.gms:play-services-auth:8.4.0' 
    compile 'com.google.android.gms:play-services-appindexing:8.4.0' 
    compile 'com.google.android.gms:play-services-ads:8.4.0' 
    compile 'com.google.android.gms:play-services-identity:8.4.0' 
    compile 'com.google.android.gms:play-services-gcm:8.4.0' 

Android清單:

<activity android:name="com.google.android.gms.ads.AdActivity" 

    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|ui 
    Mode|s‌​creenSize|smallestScreenSize" 
    android:theme="@android:style/Theme.Translucent" /> 
+0

我忘了清單 – SAmendariz

+0

<活動機器人:名字= 「com.google.android.gms.ads.AdActivity」 機器人:configChanges = 「鍵盤| keyboardHidden |方向|屏幕布置| uiMode |屏幕尺寸| smallestScreenSize」 android:theme =「@ android:style/Theme.Translucent」/> – SAmendariz

回答

0

改變你ExpandableListView

android:layout_height="0dp"  
android:layout_weight="1" 
+0

感謝您的幫助 – SAmendariz