如何修复adview关闭标记错误? [英] How to fix adview closing tag error ?

查看:97
本文介绍了如何修复adview关闭标记错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?xml version =1.0encoding =UTF-8?> 
< RelativeLayout xmlns:android =http://schemas.android.com/apk/res/android
xmlns:tools =http://schemas.android.com/tools
android:layout_height =match_parent
android:layout_width =match_parent
tools:context =。MainActivity>

<! - 示例AdMob App ID:已编辑ID - >
< meta-data
android:name =com.google.android.gms.ads.APPLICATION_ID
android:value =[ADMOB_APP_ID]/>


< com.google.android.gms.ads.AdView
android:id =@ + id / adview
android:layout_width =wrap_content
android:layout_height =wrap_content
android:layout_centerHorizo​​ntal =true
android:layout_alignParentBottom =true
ads:adSize =BANNER
ads :adUnitId =已编辑ID
com.google.android.gms.ads.AdView />


< / RelativeLayout>





我的尝试:



我不知道怎么解决这个问题,它在com.google.android.gms.ads上说= .AdView /> 

解决方案

查看您发布的XML的倒数第二行。

 com.google.android.gms.ads.AdView 



这不是有效的属性。事实上,除了/>之外,看起来该行甚至不应该存在。它的一部分。



XML属性的格式始终为 name = value


<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    tools:context=".MainActivity">

    <!-- Sample AdMob App ID: Edited out ID -->
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="[ADMOB_APP_ID]"/>


    <com.google.android.gms.ads.AdView
    android:id="@+id/adview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="Edited out ID"
    com.google.android.gms.ads.AdView/>


</RelativeLayout>



What I have tried:

I am at a loss how to fix this, it says "=" expected at com.google.android.gms.ads.AdView/>

解决方案

Look at the second to last line of that XML you posted.

com.google.android.gms.ads.AdView


That's not a valid attribute. In fact, it looks like that line should not even be there, except for the "/>" part of it.

XML attributes are always of the format name="value".


这篇关于如何修复adview关闭标记错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆