This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Android and the fly likes How to set RoundRectangle Shape to an Image in a ImageView in Android? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to set RoundRectangle Shape to an Image in a ImageView in Android?" Watch "How to set RoundRectangle Shape to an Image in a ImageView in Android?" New topic
Author

How to set RoundRectangle Shape to an Image in a ImageView in Android?

Sankar GaneshB.E
Greenhorn

Joined: Aug 31, 2010
Posts: 5
Hai Frnds,
I serached in net, plenty of the following xml code only,
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF" />
<stroke android:width="1dp" android:color="#000000" />
<padding android:left="1dp" android:top="1dp" android:right="1dp"
android:bottom="1dp" />
</shape>

But i want to know to how to set it for am image in a ImageView

my sample code is

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
androidrientation="vertical"
android:layout_width="fill_parent" android:layout_height="340dip">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"android:background="@color/black" android:stretchColumns="1" android:layout_margin="10dip">
<TableRow>
<ImageView android:id="@+id/eve_img" android:layout_width="60dip" android:layout_height="60dip" />
</TableRow>
</TableLayout>
</LinearLayout>
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

create a ShapeDrawable and have it as background of your ImageView(referenced as @drawable/filename).

[List of FAQs] | [Android FAQ] | [Samuh Varta]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set RoundRectangle Shape to an Image in a ImageView in Android?
 
Similar Threads
Button Not coming in Center
list view problem
how can we view the two lists on a single display???
How to capture the current screen from device
ListView Problem