2

I'm creating a fragment that contains two listviews ,the two in a linearlayout that has as orientation:horizontal; the second listview is in a horizontalscrollview; the problem is in the second listview;

I should have in each row of the listview 6 textview there's one 100 textview in the first row. The other rows have the correct number of textviews.

When I was debugging, I deduced that the problem is in my adapter in the getview function, I'm not sure what the exact issue is.

Here is the adapter of the listview that I'm referring to:

@Override
public View getView(int position,View convertView,ViewGroup parent)
{
    View row = convertView;
    if(row==null)
    {
        row =inflater.inflate(R.layout.list_live_2,parent,false);

    }
    List<String> stages = getItem(position);
    LinearLayout linear_layout= (LinearLayout) row.findViewById(R.id.layout_stages);

    LinearLayout.LayoutParams layoutparams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 71);
    layoutparams.setMargins(0,0,10,0);
    for(int j=0;j<stages.size();++j)
    {
        TextView textView =new TextView (row.getContext());
        textView.setText(stages.get(j));
        textView.setLayoutParams(layoutparams);
        linear_layout.addView(textView);
    }

    return row;
}
Huey
  • 5,110
  • 6
  • 32
  • 44

0 Answers0