XML : Android View Pager with rounded corner

I am working on ViewPager and its working fine. Now i want to modify design of pager in a way that pages are display with rounded corners. I have created a xml for it. Below is my xml -

    <?xml version="1.0" encoding="utf-8"?>   <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >      <solid android:color="#FFFFFF"/>    <corners android:radius="50px"/>    <padding         android:left="0dp"         android:top="0dp"         android:right="0dp"                 android:bottom="0dp" />    

and here is my viewpager item view -

  <?xml version="1.0" encoding="utf-8"?>          <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:padding="20dp" >    <RelativeLayout      android:layout_width="match_parent"      android:layout_height="match_parent"      android:background="@drawable/round_bg" >        <ImageView          android:id="@+id/event_iv"          android:layout_width="match_parent"          android:layout_height="match_parent"          android:adjustViewBounds="true"          android:contentDescription="@string/app_name"          android:scaleType="centerCrop" />      </RelativeLayout>     </LinearLayout>    

when running code it display square. Rounded corner are not applied to my view.

Please help me

Thanks in advance.

No comments:

Post a Comment