I trying to add image into LinearLayout
(linearForImage) dynamically, but it doesn't work.
val image = ImageView(activity)
image.setLayoutParams(LinearLayout.LayoutParams(80, 60))
for (i in 1..5){
linearForImage.removeView(image)
image.setImageResource(R.drawable.ic_add)
linearForImage.addView(image)
}
I expect I will get 4 or 5 images in the LinearLayout
, but there are no image is set.