2
* .xml 파일로 작성된 제목 화면에 adMob을 추가 할 수 있습니다.Android에서 ViewClass에 AdMob을 추가하는 방법
setContentView(R.layout.main);
AdView adView = (AdView)findViewById(R.id.ad);
adView.requestFreshAd();
main.xml에 다음이 포함
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/de.xazen.tictactoe"
android:background="@drawable/title"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.admob.android.ads.AdView
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
myapp:backgroundColor="#000000"
myapp:primaryTextColor="#FFFFFF"
myapp:secondaryTextColor="#CCCCCC"
/>
</RelativeLayout>
게임 자체는 Tttview로 작성되었습니다.
public class TttView extends View
활성 Game.java는 TttView의 인스턴스를 생성 및 배치로 사용의 setContent (tttView)를 사용한다.
public class Game extends Activity{
private TttView tttView;
.
.
.
setContentView(tttView);
}
어떻게하면 게임 자체에 adMob을 추가 할 수 있습니까?