티스토리 뷰
원문(영문) http://devappandroid.com/listview/simple-listview-example-in-android
먼저 listview를 위해 파일을 만들어야 합니다.
<ListView android:id=“@id/android:list” android:layout_width=”fill_parent”
android:layout_height=”wrap_content” />
이제 아래와같이 Class 선언을 해야 합니다.
public class listview extends ListActivity {
그 후 string[] 배열 하나를 정의합니다.
private String all_dis_list[] = { “DEVELOPER”, “APPLICATION”, “ANDROID”,
“DEVAPPANDROID”, “TUTORIALS”, “JAVA”, “PROGRAMMING”, “EXAMPLES” };
그 후 setListAdapter()
setListAdapter(new ArrayAdapter(this,
android.R.layout.simple_list_item_1, all_dis_list));
그리고 listview 클릭 이벤트
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Object o = this.getListAdapter().getItem(position);
String developer = o.toString();
Toast.makeText(this, “Selected Item: ” + ” ” + developer,
Toast.LENGTH_LONG).show();}
이 프로그래밍의 스크린샷…
'모바일 > Android' 카테고리의 다른 글
custom ListView (0) | 2012.05.26 |
---|---|
섹션 그룹 ListView (0) | 2012.05.25 |
appspresso + jQueryMobile 하이브리드앱에서 select box가 동작 안할때 (0) | 2012.05.15 |
Phonegap 안드로이드 프로젝트 화면 회전시 앱 종료되는 문제 (0) | 2012.05.14 |
안드로이드 아이콘 크기 (0) | 2012.05.07 |
- Total
- Today
- Yesterday
- javascript
- Wordpress
- Docker
- Prototype
- centos
- macos
- JQuery
- mssql
- git
- ASP
- 안드로이드
- Debug
- Linux
- sencha touch
- 한글
- classic asp
- PHP
- IOS
- JSON
- 워드프레스
- iphone
- API
- laravel
- IE
- nodejs
- Mac
- iis
- nginx
- Android
- CSS
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |