I want to create a Listview
that will hold 1 to 'n' nos of TextView
data horizontally, this Textview
data and width size will come from DB
?
I don't know how to set the width of TextView
dynamically with holder?
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
ViewHolder holder = new ViewHolder();
if (view == null) {
view = View.inflate(cntxts, R.layout.list_header_col, null);
String [] ColNmae= (String[]) objects.get(0);
int Width= Integer.parseInt(ColNmae[2].toString());
LinearLayout layout=new LinearLayout(cntxts);
// layout.setLayoutParams(new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT));
TextView Textview = new TextView(cntxts);
HorizontalScrollView hr = new HorizontalScrollView(cntxts);
for(int i=0;i<objects.size();i++) {
holder.Textview=new TextView(cntxts);
layout.setLayoutParams(new RelativeLayout.LayoutParams(Width,80));
layout.addView(holder.Textview);
}
hr.addView(layout);
view = hr;
view.setTag(holder);
} else {
holder = (ViewHolder) view.getTag();
}
notifyDataSetChanged();
final String[] objMain = (String[]) getItem(position);
holder.Textview.setText(objMain[0]);
return view;
}