2016-08-12 24 views
1

我有一個可繪製的圓圈背景的視圖。我希望圓圈大於它包含視圖的大小,但仍然截斷。問題是,可繪製的大小不希望超出視圖的大小,並且整個圓圈比我需要的要小得多。可繪製的Android形狀大於它的視圖

image

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="60dp"> 
    <View 
     android:layout_width="100dp" 
     android:layout_height="100dp" 
     android:layout_alignParentRight="true" 
     android:background="@drawable/circle" /> 
</RelativeLayout> 

而且circle.xml:

我怎樣才能獲得獲得大量裁剪圈呢?

+0

將視圖大小更改爲更大的「dp」值 – Shaishav

+0

您希望的輸出是第二個圖像嗎? – sJy

回答

2
<shape android:shape="oval"> 
    <size android:width="50dp" android:height="50dp" /> 
    <solid android:color="#ff0000" /> 
</shape> 

如果問題仍然存在,您可能需要使用ImageView和setImageResource,而不是視圖和背景。

+0

繪圖工具上的標記以及scaleType中心的ImageView工作。 – Distraction

1

請確保您在查看父級及其父級中設置android:clipChildren="false"屬性。