2017-07-17 8 views
0

広告を表示するのは難しいですが、動作しません。コードにエラーは表示されません。 Viewpagerインサイド私のフラグメントに広告が表示されない物理デバイス内のXML x

sms.java

 adView = new AdView(getActivity()); 
     adView.setAdUnitId(""); 
     adView.setAdSize(AdSize.BANNER); 
     LinearLayout layout = (LinearLayout) v.findViewById(R.id.lad); 
     layout.addView(adView); 
     AdRequest adRequest= new AdRequest.Builder().build(); 
     adView.loadAd(adRequest); 

fragment_sms.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    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" 
    tools:context="com.example.user.hscresults.sms"> 
<ScrollView 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/lul" 
     android:background="#EF4D26" 
     android:isScrollContainer="false" 
     android:fillViewport="true"> 

     <RelativeLayout 
      android:id="@+id/rl" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="#29AB4C" 
      android:orientation="horizontal" 
      android:padding="10dp" 
      android:weightSum="1"> 
      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical" 
       android:id="@+id/lad" 
       android:layout_below="@+id/textView3" 
       > 
      </LinearLayout> 
     </RelativeLayout> 
    </ScrollView> 
</FrameLayout> 

私は2つのフラグメントを追加しました。 Androidの断片はうまくいっていますが、広告は表示されません。

+0

あなたのログもアップロードできます。 admobログのフィルタ –

+0

07-18 12:20:32.018 29455-29455/com.example.user.hscresults I/Ads:広告は表示されません。広告をリフレッシュしません。 07-18 12:20:32.018 29455-29455/com.example.user.hscresults I/Ads:広告のリフレッシュを今から60000ミリ秒にスケジュールします。 –

+0

はレイアウトの問題のようです - 広告によるstackoverflowの検索は表示されません。広告をリフレッシュしません。 https://stackoverflow.com/questions/21996175/ad-is-not-visible-not-refreshing-ad –

答えて

0

解決策は、onResumeステートメントとOnpauseステートメントを追加することでした。 誰もがそれを整理してくれてありがとう。