具体做法是,for (int i = 0i <numi++)
{
TextBox t = new TextBox()
Size ss = new Size(130, 27)
t.Size = ss
this.flowLayoutPanel1.Controls.Add(t)
t.Show()
}
这样就可以实现的。
用LayoutParams:
RelativeLayout insertLayout = (RelativeLayout)view1.findViewById(R.id.screen)//screen是一个RelativeLayout 布局的id
ImageView imgApple2 = new ImageView(MainActivity.this)
imgApple2.setBackgroundColor(Color.parseColor("#ffb6b4"))
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(100, 100)
layoutParams.topMargin=8
layoutParams.leftMargin=8
layoutParams.rightMargin=8
layoutParams.bottomMargin=8
insertLayout.addView(imgApple2,layoutParams)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)