可绘制的形状是否可以将其大小设置为fill_parent?

Rea*_*lar 28 android android-drawable

Android中的可绘制形状是否适用于fill_parent它的大小?

<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">

<solid
        android:color="#666666"/>

<size
        android:width="fill_parent"
        android:height="fill_parent"/>
</shape>
Run Code Online (Sandbox Code Playgroud)

编辑

这是ImageButton视图的背景.我希望按钮的图标后面有一个圆圈,但我并不总是知道按钮的大小(每个布局的大小不同).

Sid*_*ele 12

并不是的.不ShapeDrawable单独使用.如果您浏览ShapeDrawable文档,您将看到(您已经在标签中使用它们)唯一有效的属性是px,dp,sp,inmm

来自doc的引用: android:width="...."

可用单位为:px(像素),dp(与密度无关的像素),sp(基于首选字体大小的缩放像素),in(英寸),mm(毫米)属性如下: android:height

这是我的推测,但我怀疑为什么fill_parent属性值不起作用是因为a ShapeDrawble,与XML Layout文件不同,不会有父容器.

离开了<size.... />完全的属性和设置layout_width,并layout_height在将引用上述ShapeDrawable一个Widget是我怀疑(是否唯一的选择fill_parent是要兑现).