I have been playing with the list activity tutorial here:
http://developer.android.com/resources/tutorials/views/hello-listview.html
which tells you to start off extending List activity.
by public class Main extends ListActivity {
Which is based on inflating a textview only layout.
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="16sp" >
</TextView>
If I want to customize the layout more by adding images,and an extra linear layout above the list adapter etc- is it possible using this method- if so how do I do it?
It is possible by using a
SimpleAdapter
.Here is an example :
Now "title" is mapped to
R.id.title
, and "description" toR.id.description
(defined in the XML below).This is the corresponding XML layout, here named
row.xml
:I used two TextViews but it works the same with any kind of view.