android - 如何只设置圆圈大小(在xml中)?

标签 android xml user-interface shapes

我想设置圆圈大小,但我不想调整图层列表中其他元素的大小。 我有这段代码:

<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">

<item>
    <shape android:shape="rectangle">
        <solid android:color="@color/drawer_color" />
    </shape>
</item>
<item>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="oval">
        <gradient
            android:endColor="#1b2727"
            android:centerColor="#1a2a29"
            android:startColor="#154440"
            android:type="linear"
            android:angle="90"/>
        <size
            android:height="600dp"
            android:width="600dp" />
        <stroke
            android:width="3dip"
            android:color="@color/drawer_ring_color" />
    </shape>
</item>


</layer-list>

我发现了什么:enter image description here

还有我想看的:enter image description here

该怎么做? 谢谢!

最佳答案

不幸的是,这不会以这种方式工作,您的可绘制对象将采用您使用该可绘制对象的 View 的大小。

关于android - 如何只设置圆圈大小(在xml中)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46024341/

相关文章:

linux - 通用文件预览组件

c# - 使用C#正则表达式替换XML元素内容

安卓.view.inflateException : Binary XML file line #11: Error inflating class fragment

c# - 如何将库中的图像 uri 存储在数据库中以便稍后在 Xamarin.Android 中加载?

android - Android 应用程序自动更新时出现 "Package file was not signed correctly"错误

java - 包含多次使用 View 的自定义 xml 相对布局

java - 无法使用结果填充 SummaryTable

ios - 标签更改时 UIButton 更改宽度

Android Room notNull 字段需要 null 默认值

android - 有 2 个主题的 android 应用程序