在循环内动态创建ImageView

在循环内动态创建ImageView,第1张

在循环内动态创建ImageView

您可以根据需要修改布局图像资源和任何图像(也可以是动态的)…

LinearLayout layout = (LinearLayout)findViewById(R.id.imageLayout);for(int i=0;i<10;i++){    ImageView image = new ImageView(this);    image.setLayoutParams(new android.view.ViewGroup.LayoutParams(80,60));    image.setMaxHeight(20);    image.setMaxWidth(20);    // Adds the view to the layout    layout.addView(image);}


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5500905.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-12
下一篇2022-12-12

发表评论

登录后才能评论

评论列表(0条)

    保存