Finally (with the help of a friend) I found all answers.
The code works across many versions. This ends a long search, I hope this is of help for you!
Answer 1: nice custom layout of your list items. Customshape and customshape_pressed. Change them, this is just an example.
Answer 2: after clicking on a list item, the customshape pressed colour is shown.
Answer 3: setting an initial list item. Yes, see the 'proof of the pudding'.
If you face any problems, draw the color with an alpha (as in this example). Of course you ask: why using both the listselector and list_item_background ... we only say ... this is the best way we found.
1 Main App:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView( R.layout.activity_main);
List<String> items = Arrays.asList( "First", "Two", "Three", "Four", "Five", "Six", "Seven");
ArrayAdapter<String> adapter2 = new ArrayAdapter<String>( this, R.layout.string_entry_v2, items);
m_listView = (ListView) findViewById( R.id.list_2);
m_listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
m_listView.setAdapter(adapter2);
m_listView.setOnItemClickListener( new OnItemClickListener() {
@Override
public void onItemClick( AdapterView<?> parent, View view, int position, long id) {
Log.v( "List2", "Clicked");
}
});
// ==== SOLVING question 2: setting a default row - WITH feedback
m_listView.setItemChecked(2, true);
}
2 The layout files: activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.listselectorexample2.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="List selector" />
<ListView
android:id="@+id/list_2"
android:layout_width="match_parent"
android:layout_height="150dp"
android:listSelector="@drawable/row_selector"
android:scrollbars="vertical" />
</LinearLayout>
And the list-item entry: string_entry_v2.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="demo text"
android:background="@drawable/row_item_background" />
3 The drawable files for listselector: row_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="true" android:state_pressed="true"
android:drawable="@drawable/customshape_pressed" />
<item android:state_activated="true"
android:drawable="@drawable/customshape_pressed" />
<item android:drawable="@drawable/customshape" />
</selector>
And ... for the row: row_item_background.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_activated="true"
android:drawable="@drawable/customshape_pressed" />
<item android:drawable="@drawable/customshape" />
</selector>
4 The custom shapes for the list items: customshape.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#77ececc9"
android:endColor="#77ececc9"
android:angle="270"/>
<corners
android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp"/>
</shape>
And the customshap_pressed.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#b6dde4"
android:endColor="#b6dde4"
android:angle="270"/>
<corners
android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp"/>
</shape>