簡體   English   中英

如何在Android中為圖像制作圓角?

[英]how to make rounded corners for image in android ?

如何在Android中為圖像視圖制作圓角??

實際上,您必須在可繪制文件夾下包含選擇器文件。

我給你一個例子編碼,進行適當的更改

?xml version="1.0" encoding="UTF-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle" android:padding="10dp">
         <stroke android:width="1dp" android:color="#FF0000"/>
            <solid android:color="#FFFFFF"/>
            <corners 
                android:bottomRightRadius="30dp" 
                android:bottomLeftRadius="30dp"
                android:topLeftRadius="30dp" 
                android:topRightRadius="30dp"/>
    </shape>

機器人:背景= “@繪制/ selector.xml”

你有這樣嘗試過嗎?

<RelativeLayout
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"

    android:background="@drawable/selector.xml">
    <Imageview
    android:layout_height="100dip"
    android:layout_width="100dip"
    android:background="@drawable/image.png"/>

    </RelativeLayout>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM