여기 여기에 응용 프로그램은 단지 광고가 표시되지 않습니다 잘 작동 xml 파일응용 프로그램이 작동하지만 광고가 표시되지 않습니까?
<RelativeLayout 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=".MainActivity" >
<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="MY_AD_UNIT_ID"
ads:adSize="BANNER"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
에서 내 코드 내 MainActivity.java 코드
package com.example.ads;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import com.google.android.gms.ads.*;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Look up the AdView as a resource and load a request.
AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
입니다. 그것은 봇이 AD_UNIT_ID를 제공했기 때문에 또는 nt가로드 된 높이가 0이 되었기 때문에 adview를 wrap_content becuase로 설정하는 것과 같은 잘못된 것입니다. 이유는 매우 느린 인터넷 연결인가?
공백 ad.How의 양쪽에있다가 내가 광고
당신은 광고를 게재"MY_AD_UNIT_ID"
를 제공해야한다
인터넷이 작동하지 않는 경우 문제가 될 수 있습니다. –
adView.setApid ("154050"); 이것은 내 appid 자신의 appid로 대체하고 그것이 일한 희망 :) .. 또한 XML 파일에서 또한이 줄 광고에 귀하의 appid를 설정 : adUnitId = "yourappid". –
그래서 저는 MY_AD_UNIT_ID를 154050으로 대체해야합니다. – user3404195