Skip to content

Instantly share code, notes, and snippets.

@hyoromo
Created November 1, 2009 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyoromo/223418 to your computer and use it in GitHub Desktop.
Save hyoromo/223418 to your computer and use it in GitHub Desktop.
ListViewSample01
package jp.ne.hyoromo.android.DemoView;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
/**
* シンプルListView01
* カスタマイズなしのListView
*
* @author hyoromo
*
*/
public class DemoView01 extends Activity {
// アダプター設定リスト
private String[] mData = { "red", "yellow", "blue", "green", "pearl", "gold", "silver" };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mData);
ListView listView = (ListView) findViewById(R.id.list);
listView.setAdapter(adapter);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false" />
</LinearLayout>
<?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">
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment