Мне нужен ясный пример того, как правильно установить andmob в моем приложении, очень озадачив, я смог выяснить, что я считал самой сложной частью, составлял его против 3.2 и устанавливал минимальный sdk на 7, который является минимальным sdk, на который я хотел бы нацеливаться.Как правильно установить admob, не отображаясь на некоторых тестовых телефонах
однако
, что я нахожу сейчас, что я могу заставить его работать на моей галактики записку, но на мой LG Optimus One и галактики Аполлоном, которые являются андроид 2,1 и 2,2 соответственно ни один из этих телефонов побежал объявления, на самом деле не уверены, как это имеет смысл, я также считаю, что документация admob является очень запутанной и неясной, я интерпретирую ее как говорящую, что разработчик может использовать либо чисто xml, либо просто java-код для этого, Ive использовал чисто xml вот мой код в моем манифесте для объявления
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
редактировать: расположение кода 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/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/title_color_dark" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:orientation="vertical"
android:paddingTop="8dp" >
<TextView
android:id="@+id/saysomething"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/loading"
android:textColor="#FFFFFF"
android:textSize="30dp" />
<TextView
android:id="@+id/saysomethinginfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="@string/loading"
android:textColor="#FFFFFF"
android:textSize="17dp" />
<EditText
android:id="@+id/tweetedittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/edit_text"
android:gravity="top"
android:hint="@string/edittext_hint"
android:inputType="textCapSentences|textMultiLine|textAutoCorrect|textAutoComplete"
android:lines="4"
android:textAppearance="@style/TextAppearance.EditText" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="right"
android:orientation="horizontal" >
<TextView
android:id="@+id/charactersremaining"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/characters"
android:textColor="#FFFFFF"
android:textSize="20dp" />
<Button
android:id="@+id/posttweetbutton"
style="@style/TextAppearance.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:background="@drawable/button_background"
android:onClick="posttweetbuttonClicked"
android:text="@string/postbuttonstext"
android:textSize="15dp" />
</LinearLayout>
<com.google.ads.AdView
android:layout_marginTop="8dp"
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="a14f5be094d0328"
ads:loadAdOnCreate="true" />
</LinearLayout>
редактировать 2 новая версия макета, делает диалог активности занимают весь экран, но все еще не показывает объявление
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/title_color_dark" >
<LinearLayout
android:layout_alignParentTop="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:orientation="vertical"
android:paddingTop="8dp" >
<TextView
android:id="@+id/saysomething"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/loading"
android:textColor="#FFFFFF"
android:textSize="30dp" />
<TextView
android:id="@+id/saysomethinginfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="@string/loading"
android:textColor="#FFFFFF"
android:textSize="17dp" />
<EditText
android:id="@+id/tweetedittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/edit_text"
android:gravity="top"
android:hint="@string/edittext_hint"
android:inputType="textCapSentences|textMultiLine|textAutoCorrect|textAutoComplete"
android:lines="4"
android:textAppearance="@style/TextAppearance.EditText" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="right"
android:orientation="horizontal" >
<TextView
android:id="@+id/charactersremaining"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/characters"
android:textColor="#FFFFFF"
android:textSize="20dp" />
<Button
android:id="@+id/posttweetbutton"
style="@style/TextAppearance.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:background="@drawable/button_background"
android:onClick="posttweetbuttonClicked"
android:text="@string/postbuttonstext"
android:textSize="15dp" />
</LinearLayout>
</LinearLayout>
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_alignParentBottom="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="a14f5be094d0328"
ads:loadAdOnCreate="true" />
редактировать 3 использует все линейные макеты без каких-либо ограничений по сторонам, но все равно не создают объявление
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/title_color_dark" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:orientation="vertical"
android:paddingTop="8dp" >
<TextView
android:id="@+id/saysomething"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/loading"
android:textColor="#FFFFFF"
android:textSize="30dp" />
<TextView
android:id="@+id/saysomethinginfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="@string/loading"
android:textColor="#FFFFFF"
android:textSize="17dp" />
<EditText
android:id="@+id/tweetedittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/edit_text"
android:gravity="top"
android:hint="@string/edittext_hint"
android:inputType="textCapSentences|textMultiLine|textAutoCorrect|textAutoComplete"
android:lines="4"
android:textAppearance="@style/TextAppearance.EditText" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="right"
android:orientation="horizontal" >
<TextView
android:id="@+id/charactersremaining"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/characters"
android:textColor="#FFFFFF"
android:textSize="20dp" />
<Button
android:id="@+id/posttweetbutton"
style="@style/TextAppearance.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:background="@drawable/button_background"
android:onClick="posttweetbuttonClicked"
android:text="@string/postbuttonstext"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:orientation="vertical" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="a14f5be094d0328"
ads:loadAdOnCreate="true" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
выглядит хорошо до сих пор, можете ли вы разместить свой XML-код? –
Кроме того, если вы можете описать то, что вы считаете запутанным, мы открыты для предложений о том, как сделать документацию более четкой. –
Спасибо за ответ! Я включил код для макета: D –