2017-02-13 48 views
0

我需要這樣的:我怎樣才能建立一個透明的形狀與顏色的背景

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle" 
> 
<size android:height="32dp" 
    android:width="16dp"/> 
<solid android:color="@android:color/transparent" 
    /> 
<corners android:topLeftRadius="16dp" 
    android:bottomLeftRadius="16dp" 
/> 

The white must be transparent(not blue)

如果我用這種形狀的白色必須是透明的

裏面的

<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/yyy" 
    android:background="@color/colorPrimary"/> 

我得到一個藍色的矩形(因爲透明形狀下的顏色是藍色的)

我怎樣才能得到的形狀透明的,所以我會看到的ImageView後的顏色?

+0

你不能使用常規的PNG'Bitmap'? – pskink

+0

哈哈,是的!那很簡單,tnx –

回答

0

寫代碼到你的顏色:

<color name="transparent">#10000000</color> 

,還可以使用<solid android:color="@color/transparent">

相關問題