0
안녕하세요, 저는 ListView에 아이콘을 추가하려고합니다. 이것이 내 ListAdapter의 모습입니다.안드로이드리스트보기 사용자 정의 아이콘
String imgFilePath = ASSETS_DIR + ICON_NAME;
try {
Bitmap bitmap = BitmapFactory.decodeStream(this.getResources().getAssets()
.open(imgFilePath));
Icon.setImageBitmap(bitmap);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
가 어떻게 내 ListView에에 아이콘을 추가해야 내 아이콘 얼마나
ListAdapter adapter = new SimpleAdapter(this, menuItems,R.layout.list_item,
new String[] { KEY_NAME, Icon }, new int[] {R.id.name, R.id.icon});
setListAdapter(adapter);
는 그리고이 무엇입니까? 인터넷에서 예제를 사용하려고했지만 ListAdaptar와 ArrayList가 완전히 다른 방식으로 작성된 것 같습니다.
내 목록 항목 xml 파일.
<ImageView
android:id="@+id/myicon"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#dc6800"
android:textSize="16sp"
android:textStyle="bold"
android:paddingTop="6dip"
android:paddingBottom="2dip" />
아이콘이 각 목록 항목마다 다른가요? –