Skip to content

Instantly share code, notes, and snippets.

@noisywiz
Created May 10, 2014 17:01
Show Gist options
  • Save noisywiz/b4e0dd656b487b16bf67 to your computer and use it in GitHub Desktop.
Save noisywiz/b4e0dd656b487b16bf67 to your computer and use it in GitHub Desktop.
Two lines adapter in LinearLayout listView
/* --list_item layout--
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView android:id="@+id/text1"
android:textSize="6pt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3pt" />
<TextView android:id="@+id/text2"
android:textSize="4pt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3pt" />
</LinearLayout>
*/
wingListView = (ListView) findViewById(R.id.wingListView); // in main_activity ;)
wingListAdapter = new SimpleAdapter(this, Hamsters,
R.layout.list_item, new String[] {"title", "date"},
new int[] { R.id.text1, R.id.text2 });
wingListView.setAdapter(wingListAdapter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment