以下のコードでテキストビューの前に画像を動的に設定する必要があるため、これを行う方法.?私のコードは以下のとおりです..
if (attchStringArray.length > 0) {
LinearLayout attachemntLayout = new LinearLayout(mainContext);
LinearLayout.LayoutParams layoutParam = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
TextView attNameView = new TextView(mainContext);
ImageView Ivbackground= new ImageView(mainContext);
attNameView.setText(attchStringArray[2]);
attachemntLayout.addView(attNameView, layoutParam);
attachemntLayout.setBackgroundResource(R.drawable.bg_for_answers);
attachmentsection.addView(attachemntLayout);
}