我有 onCreate() {
adView = new AdView(this, AdSize.IAB_BANNER, "a15119c131293a3");
AdRequest adRequest = new AdRequest();
//adLayout is a large linear layout that takes up half of the screen
LinearLayout adLayout = (LinearLayout)findViewById(R.id.adViewLayout);
adLayout.addView(adView);
adView.loadAd(adRequest);
}
然后在清单中,我导入了所有权限和 admob 活动。
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity
可能出了什么问题?预先感谢您的帮助。广告根本不显示。
编辑:
<?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/com.easyDefinition.googledefinition"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="3dp"
>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="42dp"
>
<TextView
android:id="@+id/statusTitle"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="Define: "
android:textSize = "20dp"
android:gravity="center_vertical|center_horizontal"
android:layout_gravity="center"/>
<EditText
android:id="@+id/editTxt2"
android:layout_width="0dip"
android:layout_height="match_parent"
android:maxLength="90"
android:singleLine="true"
android:layout_weight="6"
android:textSize="16dp"
android:hint= "The word to search"
android:gravity="center_vertical|center_horizontal"
android:inputType="textNoSuggestions" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
>
<Button
android:id="@+id/googleSearchBtn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Show the definition"
android:gravity="center_vertical|center_horizontal"
android:textSize="12dp"/>
</LinearLayout>
<com.easyDefinition.googledefinition.ToolFileListView
android:id="@+id/fileListView"
android:layout_width="fill_parent"
android:layout_height="20dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/adViewLayout"
>
</LinearLayout>
</LinearLayout>
没有 Logcat 错误
这算不算?
02-12 00:26:15.223: E/webview(18040): registerForStylusPenEvent onAttachedToWindow
02-12 00:26:15.223: E/webview(18040): registerForStylusPenEvent START
02-12 00:26:15.228: E/webview(18040): registerForStylusPenEvent END