Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImageView with rouded corners, solid border and glow effect

I want to put rounded corners and border to an ImageView, with custom border color. Also, I would like to achieve a glowing effect with the color of the border. Attached sample image. Note that the source image has square borders. I suppose this is achievable only by using Canvas? Any ideas and sample code?

enter image description here

like image 651
user1718159 Avatar asked Dec 03 '12 14:12

user1718159


1 Answers

this is what i have done for my ImageView to make same changes as you want.

made one image_shape.xml

    <?xml version="1.0" encoding="UTF-8"?>
<shape 
    xmlns:android="http://schemas.android.com/apk/res/android">
    <stroke 
        android:width="1dp" 
        />
    <corners 
        android:radius="50dp" />

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


    <solid android:color="#10151D"/>

</shape>

Now, put this xml as the background of your imageView then you will get effect as you want. Right now i have set my own color. you can put your desire color and get effect as rounded glow border effect.

like image 128
Shreyash Mahajan Avatar answered Nov 04 '22 16:11

Shreyash Mahajan