Java Admob至6.4.1 dosnt工程
我使用了谷歌播放服务库,这是我的 主xmlJava Admob至6.4.1 dosnt工程,java,android,xml,android-layout,libgdx,Java,Android,Xml,Android Layout,Libgdx,我使用了谷歌播放服务库,这是我的 主xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="MyUnitID" />
</LinearLayout>
这是我的清单(不确定它是否真的好..里面有很多狗屎)
在main.xml图形布局中,我可以看到红色框,上面写着“缺少必需的xml属性”adSize
我确实设置了adSize。。。
我只想当我的游戏工作时,在菜单状态下会有一个广告。
请帮帮我,我要换衣服
ads:adSize="BANNER"
到
否则,广告将不会根据屏幕大小调整大小(除非这是您想要的),并且在java文件的onCreate方法中添加:
adView = new AdView(this);
AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
//.addTestDevice("") - You'll find your device ID in the LogCat output starting with a # it is recommended that you have a test device but it's up to you
.build();
adView.loadAd(adRequest);
你添加了java方面的东西来加载广告了吗?
ads:adSize="SMART_BANNER"
adView = new AdView(this);
AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
//.addTestDevice("") - You'll find your device ID in the LogCat output starting with a # it is recommended that you have a test device but it's up to you
.build();
adView.loadAd(adRequest);