I have PreferenceActivity with some sample content:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="First Category"
android:key="first_category">
<CheckBoxPreference
android:key="perform_updates"
android:summary="Enable or disable data updates"
android:title="Enable updates"
android:defaultValue="true"
/>
<ListPreference
android:key="updates_interval"
android:title="Updates interval"
android:summary="Define how often updates will be performed"
android:defaultValue="1000"
android:entries="@array/updateInterval"
android:entryValues="@array/updateIntervalValues"
android:dependency="perform_updates"
/>
</PreferenceCategory>
<PreferenceCategory
android:title="Second Category"
android:key="second_category">
<EditTextPreference
android:key="welcome_message"
android:title="Welcome Message"
android:summary="Define the Welcome message to be shown"
android:dialogTitle="Welcome Message"
android:dialogMessage="Provide a message"
android:defaultValue="Default welcome message"/>
</PreferenceCategory>
</PreferenceScreen>
As all of you know, it’s looking incredibly ugly in all Androids before 4.0. Now the idea is to create custom theme and apply it to the activity. I want to make the ListView look like on the picture below:

I can adjust the separators (“Personalizacja”, “Informacje[…]”) by overriding <item name="listSeparatorTextViewStyle">… but the real question is: how do I create such background with rounded corners for separate groups? I’m not able to find out any way to set custom style to first/last element in the group.
I’d be thankful for any ideas. But please note that I want to achieve it via styles & themes only.
btw. If you have an idea how to achieve the above, but without rounded corners – let me know too!
I think the effect can be achieved for an android ListView. The main feature of the ListView is to recycle its row entries so that they don’t have to be instantiated for every list entry.
The trick is to create multiple list element layouts and to swap them in in your ListAdapater. So you would basically have list entry for the group header, the group top element, the group middle elements and the group bottom element. All in all 4 different layout “templates” that your ViewHolder in your adapter should hold on to.
The following image describes the different layout segments: