crickpatel0024
crickpatel0024

Reputation: 2027

How to Image button create circle in list view in android?

I developing android app .and i used in custom list view .but i want to store profile image button create round shape .how to possible and big image blur in devices how to set original image size set in android . my xml code in below . please help me!!!

Thanks!!!

I want to look like this!!!

enter image description here

And i create my image!!

enter image description here

my xml custom list code::

<!-- ListRow Left sied Thumbnail image -->

<RelativeLayout
    android:id="@+id/thumbnail_relative"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="5dip" >

    <LinearLayout
        android:id="@+id/thumbnail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_marginRight="5dip"
        android:padding="3dip" >

        <ImageButton
            android:id="@+id/list_home_logo_image"
            android:layout_width="40dip"
            android:layout_height="40dip"
            android:background="@android:color/transparent"
            android:scaleType="fitXY" />
    </LinearLayout>

    <!-- Title Of Song -->

    <TextView
        android:id="@+id/home_list_username"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@+id/thumbnail"
        android:text=""
        android:textColor="#040404"
        android:textSize="15dip"
        android:textStyle="bold"
        android:typeface="sans" />
</RelativeLayout>

<ImageButton
    android:id="@+id/sarees_big_img"
    android:layout_width="fill_parent"
    android:layout_height="150dp"
    android:layout_alignLeft="@+id/thumbnail_relative"
    android:layout_alignTop="@+id/thumbnail_relative"
    android:layout_marginTop="50dp"
    android:background="@android:color/transparent" 
    android:scaleType="fitXY"/>

<TextView
    android:id="@+id/home_view_txt_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/sarees_big_img"
    android:layout_marginTop="24dp"
    android:text="" />

<Button
    android:id="@+id/close_home_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignRight="@+id/sarees_big_img"
    android:layout_below="@+id/sarees_big_img"
    android:text="Closet It" />

<TextView
    android:id="@+id/itemName_txt"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/close_home_btn"
    android:layout_alignBottom="@+id/close_home_btn"
    android:layout_marginRight="54dp"
    android:layout_toLeftOf="@+id/close_home_btn"
    android:text="" />

How to image perfect size set in image button any idea please help me!!!

Upvotes: 1

Views: 2251

Answers (1)

Shajeel Afzal
Shajeel Afzal

Reputation: 5953

Instead of writing whole XML for circular image view, you can use a open source library:

1- CircularImageView

2- Circle ImageView

Read the instruction on the GitHub on how to use these libraries.

Upvotes: 3

Related Questions