0

我正在获取运行时图像视图,如何将这些图像视图添加到一个单一的线性布局中。

LinearLayout linearLayout=new LinearLayout(this);
    linearLayout.setOrientation(LinearLayout.HORIZONTAL);
    LinearLayout.LayoutParams vp=new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    ImageView imageView= new ImageView(this);
    imageView.setImageBitmap(bitMap);
    imageView.setVisibility(View.VISIBLE);
    imageView.setBackgroundColor(0xFFFF00FF);

    //linearLayout=LinearLayout+imageView;
    LinearLayout.LayoutParams Iv=new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    linearLayout.setLayoutParams(Iv);

    linearLayout.addView(imageView);
    setContentView(linearLayout,vp);
4

1 回答 1

0
LinearLayout linearLayout=new LinearLayout(this);
    linearLayout.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams vp=new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);

ImageView imSex = new ImageView(context);
addView(imSex,linearLayout);
于 2013-05-09T13:04:07.750 回答