I want to display several representations of the image and text in each line of the list, and the number of lines is not fixed (the number of lines can be selected from the server) How to add horizontal scrolling to each line. I am going to use for a loop for the number of images in the getView method, this is the right way to do this.
My question is how can I inflate the horizontal scroll with views of the images of numbers in a row in the getview method
public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder viewHolder; viewHolder = new ViewHolder(); // View vi = convertView; //if (vi == null) //{ int Numberofimageview=2; for(int i=0;i<Numberofimageview;i++) { // assume i want to display 2 imageview in every row LayoutInflater inflater = (LayoutInflater) con .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.my_row_layout, parent, false); viewHolder.title = (TextView) convertView.findViewById(R.id.title); Log.d("myapp", "position" + position); convertView.setTag(viewHolder); // } // else // { // viewHolder=(ViewHolder)convertView.getTag(); // } viewHolder.title.setText(data.get(position)); } return convertView;
} 
This is xml for string
RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" > <ImageView android:id="@+id/wagon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:src="@drawable/wagon" /> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/wagon" android:layout_centerVertical="true" android:layout_marginLeft="16dp" android:src="@drawable/video" /> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/imageView1" android:layout_marginLeft="33dp" android:layout_toRightOf="@+id/imageView1" android:text="title of file" /> <TextView android:id="@+id/type" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/title" android:layout_alignRight="@+id/title" android:layout_marginBottom="18dp" android:text="type of file" />
source share