Ankata
Ankata

Reputation: 101

Set border rounded for list view

I am trying to set rounded border for list view in android. I used shape xml to set background for list view. However, when I click on an item, the highlight is over rounded area.

Is there any ways to overcome this problem? Thanks.

Upvotes: 0

Views: 696

Answers (1)

Aerrow
Aerrow

Reputation: 12134

This code change your list view as rounded corner

shape.xml

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
     android:shape="rectangle"> 
     <gradient android:startColor="#SomeGradientBeginColor" android:endColor="#SomeGradientEndColor" 
            android:angle="270"/> 

    <corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" 
     android:topLeftRadius="7dp" android:topRightRadius="7dp"/> 
</shape> 

put is xml file in your drawable folder, the in your listview set like this, android:background:"@drawable/shape"

Upvotes: 1

Related Questions