【问题标题】:image within circle background in android?android中圆圈背景内的图像?
【发布时间】:2012-10-02 02:05:46
【问题描述】:

我需要加载图像,但是当我加载图像时,它不应该是方形/矩形,而是圆形。所以我想要圆圈中的图像,边框应该是白色的。如何以圆形/椭圆形加载图像。我尝试使用形状 = 椭圆和渐变 = 270 创建背景,并将图像视图的背景设置为该形状。我还能如何设置 imageview 的背景。

    <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >
    <gradient android:startColor="#FFFF0000" android:endColor="#80FF00FF"
            android:angle="270"/>
</shape>

【问题讨论】:

标签: android background uiimageview


【解决方案1】:

How to make an ImageView with rounded corners?

解决了我的问题。我需要在位图图像周围有一个白色边框,现在弄清楚:(

【讨论】:

    【解决方案2】:

    创建一个以圆圈为中心的图像。那个圆圈应该是透明的。

    把这个图像层放在你的图像上:)

    Relative 或 FrameLayout 将完成这项工作。

    【讨论】:

    • 不工作:(实际图像是方形的,然后是这个透明的圆圈。我希望实际图像是白色背景的圆圈
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-28
    • 1970-01-01
    • 2021-09-09
    • 2020-05-11
    • 2015-06-09
    • 2020-12-06
    • 2012-06-16
    相关资源
    最近更新 更多