0
我在表格佈局的表格行中動態設置imageview文本視圖。 但我無法設置imageview.i嘗試it.its olny顯示textview不Imageview。我如何設置imageview。 請幫助我。下面 是代碼 -在我的應用程序中動態設置圖像視圖在桌面佈局android
Bitmap b=ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile((file.getPath()+".jpeg")), 50,50);
im=new ImageView(this);
im.setImageBitmap(b);
im.setLayoutParams(new LayoutParams(50,50));
nameoffile=new TextView(this);
nameoffile.setText(myfile);
nameoffile.setWidth(200);
sizeoffile=new TextView(this);
sizeoffile.setText(size+"KB");
sizeoffile.setWidth(100);
tr=new TableRow(this);
tr.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
tr.addView(im);
tr.addView(nameoffile);
tr.addView(sizeoffile);
tl.addView(tr,new TableLayout.LayoutParams(
LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));