Android admob中必需的XML属性adSize错误?
我正在尝试在我的应用程序中添加admob广告。 我在项目属性中导入了google play服务库 我实现了像guid一样的应用程序,但是im得到了xml属性adsize error的错误 这是我的XMLAndroid admob中必需的XML属性adSize错误?,android,xml,admob,Android,Xml,Admob,我正在尝试在我的应用程序中添加admob广告。 我在项目属性中导入了google play服务库 我实现了像guid一样的应用程序,但是im得到了xml属性adsize error的错误 这是我的XML <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background2"
android:orientation="vertical" >
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:paddingTop="15dp"
android:shrinkColumns="50"
android:stretchColumns="1" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="15dp"
android:layout_weight="1"
android:paddingLeft="0dp"
android:paddingTop="25dp" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/gt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/gt1"
android:textAppearance="?android:attr/textAppearanceMediumInverse"
android:textColor="#FDD017"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/gt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/gt2"
android:textColor="#FDD017"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/gt3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/gt3"
android:textColor="#FDD017"
android:textStyle="bold" />
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="15dp"
android:layout_weight="1"
android:paddingLeft="0dp"
android:paddingTop="30dp" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/gt4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/gt4"
android:textColor="#FDD017"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/gt5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/gt5"
android:textColor="#FDD017"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/gt6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/gt6"
android:textColor="#FDD017"
android:textStyle="bold" />
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="15dp"
android:layout_weight="1"
android:paddingLeft="0dp"
android:paddingTop="30dp" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/gt7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/gt7"
android:textColor="#FDD017"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/gt8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/gt8"
android:textColor="#FDD017"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/gt9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/gt9"
android:textColor="#FDD017"
android:textStyle="bold" />
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="15dp"
android:layout_weight="1"
android:paddingLeft="0dp"
android:paddingTop="30dp" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/gt10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/gt10"
android:textColor="#FDD017"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/gt11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/gt11"
android:textColor="#FDD017"
android:textStyle="bold" />
</LinearLayout>
</TableRow>
</TableLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-xxxxxxxxxxxxx" >
</com.google.android.gms.ads.AdView>
如果需要这些信息,我的程序有三个选项卡指定admob adview的宽度和高度或将父布局更改为linear将parentlayout更改为linear layout,但没有任何效果我应该给出多大的建议?尝试将adview放在活动的顶部……就在TableLayout的正上方我找到了答案这是一个您应该关闭的错误eclipse并重新打开它!如果你想输入这个答案,那么我可以选择你的答案作为好答案,并且你可以获得一些积分@williamThank,关闭并重新打开eclipse就是答案
AdView adView = (AdView)rootView.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);