Pavan kumar
Pavan kumar

Reputation: 41

how to crop my image as shown below image in android

I am very new to android ,I am trying to display my image as shown below,but my my image is not coming up properly.Please help me out in solving this problem.

click here for image i need like this

Thanks in advance.

Upvotes: 0

Views: 50

Answers (2)

Haroon
Haroon

Reputation: 505

ImageLoaderConfiguration config = new       ImageLoaderConfiguration.Builder(thisContext    
.discCacheFileNameGenerator(new HashCodeFileNameGenerator()).build();
DisplayImageOptions options = new DisplayImageOptions.Builder()
 .displayer(new RoundedBitmapDisplayer(10)) //rounded corner bitmap
.cacheInMemory(true)
  .cacheOnDisc(true)
 .build();
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
imageLoader.displayImage(image_url,image_view, options );

Upvotes: 0

Gorio
Gorio

Reputation: 1646

You could use scaleType tag in your layout like this example

<LinearLayout
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:gravity="center">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/image"
        android:scaleType="centerCrop" />
</LinearLayout>

More information about scaleType can be found here http://developer.android.com/reference/android/widget/ImageView.html#attr_android:scaleType

Upvotes: 2

Related Questions