Lazyadapter for listview (vertical) inside this, what i do ,set lazyadapter on horizontal listview & HLV is declare in custom layout of this lazyadapter.
class lazyadapter extends BaseAdapter {
Context context;
LayoutInflater inflater;
ArrayList<HashMap<String, String>> data;
public lazyadapter(Context context,
ArrayList<HashMap<String, String>> arraylist) {
this.context = context;
data = arraylist;
}
@Override
public int getCount() {
return data.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView,
ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View itemView = inflater
.inflate(R.layout.horizontal, parent, false);
HashMap<String, String> mapss;
mapss = new HashMap<String, String>();
String dataq = data.get(position).get("subcatname");
String catname = data.get(position).get("catname");
String image = data.get(position).get("image");
String id = data.get(position).get("id");
mapss.put("dataq", dataq);
mapss.put("image", image);
mapss.put("catname", catname);
mapss.put("id", id);
TextView uu = (TextView) itemView.findViewById(R.id.textView1);
hlvSimpleList1 = (HorizontalListView) itemView
.findViewById(R.id.hlvSimpleList1);
uu.setText(data.get(position).get("catname"));
String tttt = data.get(position).get("cc");
if (tttt.equals("1")) {
uu.setVisibility(0);
ap = new ArrayList<HashMap<String, String>>();
} else {
uu.setVisibility(8);
hlvSimpleList1.setVisibility(8);
}
ap.add(mapss);
lazyadapter4 adpp = new lazyadapter4(getApplicationContext(), ap);
adpp.notifyDataSetChanged();
hlvSimpleList1.setAdapter(adpp);
return itemView;
}
}
Thanks in Advance..please help me to get rid from this..
In the Row.xml of the listview (which you will inflate in adapter's getView(..) function) use HorizontalScrollView as Parent element .