당신은 당신의 ListView의 Arraydapter를 통해 사용자 정의보기를 제공 할 수있다 (당신은 당신의 자신을 만들 수있는 ArrayAdapter와를 확장 할 수 있습니다). 다른 질문에 네, TableRows를 클릭 할 수있게 할 수 있습니다 (예 : XML 레이아웃 파일에서이 작업을 수행 할 수 있음).
MyAdapter myAdapter = new MyAdapter(this, data);
myListView.setAdapter(myAdapter);
I :
class MyAdapter extends BaseAdapter {
private Context context;
private LayoutInflater inflater;
private ViewHolder holder;
private ArrayList<HashMap<String, String>> data;
public MyAdapter(Context context, ArrayList<HashMap<String, String>> data) {
this.context = context;
this.data = data;
inflater = LayoutInflater.from(context);
}
// Below the Magic
public View getView(int position, View convertView, ViewGroup parent) {
inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
if(convertView == null || convertView.getTag() == null) {
// Here you load the list_items.xml an inflate your Layout with it
convertView = inflater.inflate(R.layout.list_items, null);
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.mytext);
holder.image = (ImageView) convertView.findViewById(R.id.myimage);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// We get the HashMap for our current Position in the ListView
row = data.get(position);
if(row != null) {
holder.text.setText(row.get("test"));
// Below could be setImageBitmap, setImageResource,...
// depends on how you get your image
holder.image.setImageBitmap(getImage(row.get("image"));
}
return convertView;
}
class ViewHolder {
TextView text;
ImageView image;
}
}
public getImage(String image) {
// Get your image from where you want it SD, drawable, internet)
}
이 같이 호출 :
<LinearLayout
android:orientation="horizontal"
[...]
<ImageView
[...]
android:id="@+id/myimage"/>
<TextView
[...]
android:id="@+id/mytext"/>
</LinearLayout>
는 그런 다음 BaseAdapter를 만들 :
나는 그것을 확인해 보겠습니다! 감사 :) –