Android : How to fit image in circular border and rectangular border

on Monday, October 6, 2014


By using xml files drawn circle and rectangle shapes here is code rectangle.xml



<?xml version="1.0" encoding="utf-8"?>



<size
android:height="120dp"
android:width="180dp" />

<corners android:radius="30px" />

<stroke
android:width="3dp"
android:color="@android:color/holo_green_dark" />


and here is my circle.xml code



<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">

<solid
android:color="@android:color/transparent"/>

<size
android:width="120dp"
android:height="120dp"/>

<stroke
android:width="3dp"
android:color="@android:color/holo_green_dark" />
</shape>


now arranged these drawable as background for imageview then able to see image background with respective shape but if i place image in imageview then image is out of circle or rectangle how to make image with in border.(Sorry for grammar mistakes)


0 comments:

Post a Comment