И в своем коде получите LinearLayout:
LinearLayout yourLinearLayout = (LinearLayout) findViewById(R.id.yourLinearLayout);
Определите общий объект LayoutParams:
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
И добавьте ваши ImageViews в свой LinearLayout с помощью для l oop :
for (int i = 0; i < imagesToAdd.size(); i++) {
ImageView imgView = new ImageView(this);
imgView.setImageResource("yourResourceID" + i);
imgView.setLayoutParams(layoutParams);
yourLinearLayout.addView(imgView);
}