Wednesday, January 2, 2019

How to custom round imageview in android example

How to custom round imageview in android example   res/drawble/custom_round_image.xml <selector xmlns:android="http://sche... thumbnail 1 summary

How to custom round imageview in android example

How to custom round imageview in android example 

res/drawble/custom_round_image.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_pressed="true">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">

            <solid android:color="#eae1ff" />
            <corners android:radius="2dp"/>

            <size
                android:height="70dp"
                android:width="70dp" />

            <padding
                android:bottom="0dp"
                android:left="0dp"
                android:right="0dp"
                android:top="0dp" />

        </shape>
    </item>
    <item>
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">

            <solid android:color="#DF0174" />
            <corners android:radius="2dp"/>

            <size
                android:height="70dp"
                android:width="70dp" />

            <padding
                android:bottom="0dp"
                android:left="0dp"
                android:right="0dp"
                android:top="0dp" />

        </shape>
    </item>
</selector>


res/layout/activity_main.xml


 
 <ImageView
                android:id="@+id/img_logo_create"
                android:contentDescription="@string/app_name"
                android:layout_width="wrap_content"
                android:background="@drawable/custom_round_image"
                android:src="@drawable/ic_play_circle_filled_black_48dp"
                android:layout_gravity="center"
                android:scaleType="centerInside"
                android:layout_height="wrap_content" />
Success :
 

Video code: 

                                      

No comments

Post a Comment