Android Studio显示警告:此处不允许元素合并 [英] Android Studio shows warning: Element merge is not allowed here

查看:247
本文介绍了Android Studio显示警告:此处不允许元素合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基于LinearLayout创建自定义视图.该类扩展了LinearLayout类,在布局中我拥有:

I create custom view based on LinearLayout. Class extends the LinearLayout class, in layout I have:

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
    <merge>
        some staff here
    </merge>
</layout>

Android Studio显示警告Element merge is not allowed here,但该应用程序可以运行.

Android Studio shows the the warning Element merge is not allowed here, but app works.

怎么了?

推荐答案

我认为这只是Android Studio中的一个小故障.甚至官方文档也将merge作为layout的直接子代: https://developer.android.com/topic/libraries/data-binding/index.html

I believe it's just a glitch in Android studio. Even the official documentation has merge as a direct child of layout: https://developer.android.com/topic/libraries/data-binding/index.html

我在此处提交了一个错误:

I filed a bug there: https://code.google.com/p/android/issues/detail?id=286406&thanks=286406&ts=1490873944

Edit2:错误已在AS 3.5 Canary 12中固定为\ o/

Bug is fixed \o/ in AS 3.5 Canary 12

这篇关于Android Studio显示警告:此处不允许元素合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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