gpt4 book ai didi

android - 布局 XML 中的注释不起作用

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:39:39 26 4
gpt4 key购买 nike

是的,我查过了!

<!-- comment --> 

看来是正确的选择,但我在 android-studio 中遇到错误Gradle:解析 XML 时出错:格式不正确(无效标记)

当我这样做的时候

<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<!-- android:background="?android:attr/selectableItemBackground" -->
android:id="@+id/imageButton"
android:layout_alignParentTop="true"
android:src="@drawable/gfx_select_medium"
android:layout_marginRight="22dp"/>

感谢任何帮助,谢谢!

最佳答案

XML 注释不能放在标记标记内。例如,将注释移动到 ImageButton 标记的上方或下方。

这是 spec引用,重点补充:

Comments may appear anywhere in a document outside other markup

在哪里markup定义为:

Markup takes the form of start-tags, end-tags, empty-element tags, entity references, character references, comments, CDATA section delimiters, document type declarations, processing instructions, XML declarations, text declarations, and any white space that is at the top level of the document entity (that is, outside the document element and not inside any other markup)

关于android - 布局 XML 中的注释不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19743816/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com