【问题标题】:How can I make this background as an xml drawable?我怎样才能把这个背景作为一个 xml drawable?
【发布时间】:2015-11-26 22:54:15
【问题描述】:

我想给我的应用一个背景,我想在 xml 文件中创建它,而不是图像。
有人能帮我吗?请。

【问题讨论】:

  • 你搜索了吗?你有什么尝试吗?结果是什么?
  • 是的,我可以做蓝色背景,但我不能做白色圆圈(在同一个文件 xml 中)我尝试使用 s 形状,但如果我使用形状,我不能让该应用程序响应。对不起,我的英语不好。
  • 只需为您的视图容器使用蓝色,为视图使用带有偏移的白色椭圆形。
  • 一个形状或一个 VectorDrawable。或者9补丁。或位图。您可以选择最适合的。

标签: android background-image xml-drawable


【解决方案1】:

我明白了:

<item android:top="200px">
    <shape>
        <solid android:color="#FF954CFB" />
    </shape>
</item>

<item android:height="10dp">

    <shape>
        <solid android:color="@color/colorWhite" />
    </shape>
</item>
<item android:top="-500dp" android:bottom="300dp" android:left="-100dp" android:right="-100dp">
    <shape>
        <corners android:radius="400dp" />
        <solid android:color="@color/colorWhite" />
    </shape>
</item>

【讨论】:

    【解决方案2】:

    XML 文件:

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    
        <item android:top="200px">
            <shape>
                <solid android:color="#6bcbf4" />
            </shape>
        </item>
    
    
    
        <item android:bottom="900px">
            <shape android:shape="oval">
                <solid android:color="#FFF8F8F8"
                    />
            </shape>
        </item>
    
    
    
    </layer-list>
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-13
      • 2019-12-03
      • 2017-11-14
      • 2020-06-23
      • 2023-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多