I want to give rounded rectangle shape to the images that I am fetching them from the server and displaying in list view.
Currently I am able to make the images in a rounded rectangle shape which are available in my drawable folder. But finding the difficulties for the images fetching from the server.
Please let me know how can I do this..
Round corners to view, simply create xml for drawable, apply Radius rate to your image corner as well as you can apply background color to your view too, check below code and steps.
Create one folder named Drawable within Res, keep below xml in drawable and you can set at runtime or in layout xml to your view.
<?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#5a5a5a"/> <corners android:radius="10px"/> <padding android:left="20dp" android:top="20dp" android:right="20dp" android:bottom="20dp"/> </shape>
ImageView im=(ImageView)findViewById(R.id.imageView2); im.setBackgroundResource(R.drawable.round_border);