I have a list with a rounded corner at the top and bottom. Check out this image: 
But when I click at the top and bottom of the ListView, the List Element background is a rectangle not rounded as the ListView background above and below. Like this image:

How to solve this problem?
this is my code:
1 / list_activity.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#cacaca"> <ListView android:id="@+id/listView3" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10dp" android:background="@drawable/list_border" android:listSelector="@drawable/list_selector"/> </LinearLayout>
2 / list_border.xml
<?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#fff"/> <corners android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp" android:topLeftRadius="10dp" android:topRightRadius="10dp"/> </shape>
3 / list_selector.xml
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@color/colorPrimary" /> </selector>
4 / ListActivity.java
ListView listView = (ListView)findViewById(R.id.listView3); ArrayList<String> listItems = new ArrayList<>(); for(int i=0;i<20;i++){ listItems.add(""+i); } ArrayAdapter<String> adapter = new ArrayAdapter<>(getApplicationContext(), android.R.layout.simple_selectable_list_item, listItems); listView.setAdapter(adapter);
source share