• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Listview Image

Hi, You can use graphis and text in your list:

rowlayout.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="wrap_content" android:layout_height="wrap_content">
	<ImageView android:id="@+id/icon" android:layout_height="wrap_content"
		android:src="@drawable/icon" android:layout_width="22px"
		android:layout_marginTop="4px" android:layout_marginRight="4px"
		android:layout_marginLeft="4px">
	</ImageView>
	<TextView android:text="@+id/TextView01" android:layout_width="wrap_content"
		android:layout_height="wrap_content" android:id="@+id/label"
		android:textSize="30px"></TextView>
</LinearLayout>

and code:
Code:
public class MyList extends ListActivity {
	/** Called when the activity is first created. */
	public void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		// Create an array of Strings, that will be put to our ListActivity
		String[] names = new String[] { "Sun", "Mercury", "Venus", "Earth",
				"Mars", "Jupiter", "Saturn", "Uranus" };
		// Use your own layout and point the adapter to the UI elements which
		// contains the label
		this.setListAdapter(new ArrayAdapter<String>(this, R.layout.rowlayout,
				R.id.label, names));
	}
}
 
Back
Top Bottom