不允许使用Android

不允许使用Android

本文介绍了不允许使用Android XML元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下XML布局,它基本上给了我圆角,并在EditText上使用它.为什么Android检查器会说element solid is not allowed here以及element corners is not allowed here.

I have the following XML layout which basically gives me rounded corners and I use it on EditText's. Why does Android inspector say that the element solid is not allowed here and also element corners is not allowed here.

它工作正常,我应该离开它吗?

It works fine, should I just leave it?

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle" android:padding="10dp"
       android:layout_width="match_parent"
       android:layout_height="match_parent">
    <solid android:color="#FFFFFF" />
    <corners
        android:bottomRightRadius="5dp"
        android:bottomLeftRadius="5dp"
        android:topLeftRadius="5dp"
        android:topRightRadius="5dp" />
</shape>

推荐答案

该XML文件应位于res/drawable中.它可能位于res/layout中,这是一个错误的位置.

That XML file should be located in res/drawable. It might be located in res/layout, which is an incorrect location.

这篇关于不允许使用Android XML元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 22:38