0

Here is the drawable layout code "round_button.xml"

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="ring">
<solid android:color="#FFFFFF"/>
<stroke android:width="3dip" android:color="#E6E6E6" />
<corners android:radius="30dip"/>
</shape>

Here is the imageview code

   <ImageView
   android:id="@+id/imageView1"

   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:background="@drawable/round_button"
   android:layout_marginTop="10dp"
   android:layout_marginLeft="4dp"
   android:layout_marginRight="4dp"
   android:src="@drawable/menu1" />

But i dint get the rounded imageview

venugopal
  • 263
  • 1
  • 7
  • 14
  • 1
    It may be more efficient to handle the view dynamically by creating a class that extends imageview and handling the drawing of the image ondraw – zgc7009 Jul 06 '14 at 11:46

1 Answers1

1

From what I understand from your example code, you're expecting the background of the ImageView to act as a mask for the src.

When you define a src for an ImageView, that is what's going to be displayed. You're going to need to work a bit harder to define any image the ImageView gets as a circle.

Here's a link to how to work with masks in Android: Masking a Drawable/Bitmap on Android

Community
  • 1
  • 1
Gil Moshayof
  • 16,633
  • 4
  • 47
  • 58
  • No not like mask,i'm trying to define a rounded circle inside that i want to place my image so that the ImageView looks like rounded – venugopal Jul 06 '14 at 12:01