wawanopoulos
wawanopoulos

Reputation: 9794

Shape as background, border so small

I tried to add a thin border around my rounded imageView. To do this, i decided to add a shape as background with a padding. The result is good, there is a thin border around my imageview but this border is so small. I would like to have a border around 3dp.

I tried to play with different size (padding, corner) but the result is not good. Perhaps, there is a problem in my xml :

shape_rounded.xml :

<stroke android:width="5dp"
    android:color="#000000"
    />

<padding android:left="3dp"
    android:top="3dp"
    android:right="3dp"
    android:bottom="3dp"
    />

<corners android:bottomRightRadius="30dp" android:bottomLeftRadius="30dp"
    android:topLeftRadius="30dp" android:topRightRadius="30dp"/>

And here is how i use it :

<com.frisbeeeapp.frisbeee.utilities.RoundedImageView
        android:id="@+id/img_ex"
        android:layout_width="35dp"
        android:layout_height="35dp"
        android:gravity="center"
        android:background="@drawable/shape_rounded"
        android:scaleType="centerCrop"
        android:src="@drawable/cover2"
        android:layout_gravity="center_vertical" />

Upvotes: 1

Views: 135

Answers (1)

T D Nguyen
T D Nguyen

Reputation: 7603

I believe it will help with this:

<solid android:color="#00000000" />
<stroke android:width="8dp"
         android:color="#000000"/>
<corners android:radius="30dp" />

Upvotes: 1

Related Questions