相关疑难解决方法(0)

如何在圆内画圆形笔画?

我正在尝试实现这种效果,但无法在圆圈内制作白色圆形笔画。在我的实现中,白色笔画出现在圆圈之外

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">
            <corners android:radius="10dip" />

            <stroke
                android:width="5dip"
                android:color="#ffffff" />
            <solid android:color="#f50000" />
        </shape>

    </item>

</layer-list>
Run Code Online (Sandbox Code Playgroud)

预期输出:-

在此输入图像描述

android android-xml android-drawable

4
推荐指数
1
解决办法
2390
查看次数

在 Android 中的另一个圆圈内创建圆圈

我需要为我的相机应用程序创建图像。我在另一个圆圈内创建了一个圆圈,当我在 android studio 上看到它时看起来不错,但是在真实设备上运行它时,它与原来的不一样。这是来自真实设备的第一个图像和来自 android studio 的第二个图像。

来自真实设备的图像 圈内圈

这是我用来创建它的代码。

 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Larger circle in white-->
<item>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="oval">
        <padding android:top="5dp" android:bottom="5dp" android:right="5dp" android:left="5dp"/>
        <stroke
            android:width="1dp"
            android:color="#ffffff"/>
    </shape>
</item>
<!-- Smaller white circle in front -->
<item>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="oval">
        <solid
            android:color="#ffffff"/>
    </shape>
</item>
 </layer-list>
Run Code Online (Sandbox Code Playgroud)

为什么它显示不同的问题是什么。

android android-shape

3
推荐指数
1
解决办法
3397
查看次数

android sdk中的嵌套形状

嗨,我想绘制一个有三个矩形形状的形状:1.纯色2.渐变3.白线我该怎么做?当我尝试这个时,它不起作用.布局具有父颜色.

<shape 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    android:height="60px"
    >
    <shape 
        android:shape="rectangle" 
        android:height="30px"
        >
        <solid 
            android:color="#ff297baf" 
            />
    </shape>
    <shape 
        android:shape="rectangle"
        android:height="30px"
        >
         <gradient
  android:type="linear"
  android:startColor="#ff297baf"
  android:endColor="#ff16c0e3"
  android:angle="270"/> 
    </shape>
    <shape
        android:shape="rectangle"
        android:height="3px"
        >
        <solid 
            android:color="#FFFFFFFF"
            />
    </shape>
</shape>
Run Code Online (Sandbox Code Playgroud)

我试图用3种颜色制作渐变.从纯色开始#ff297baf,以60%开始渐变#ff297baf,#ff16c0e3然后在末尾添加一条渐变线.

android shapes xamarin.android android-shape

2
推荐指数
1
解决办法
7327
查看次数