
RelativeLayout.LayoutParams
layoutParams
=
new
RelativeLayout.LayoutParams(100,
100)
layoutParams.topMargin=8
layoutParams.leftMargin=8
layoutParams.rightMargin=8
layoutParams.bottomMargin=8
insertLayout.addView(imgApple2,layoutParams)
感觉可以用listview来实现动态增加记录的功能,你可以设置接听收到短信的时候listview的adapter添加该记录进去,同样,自己发送也可以让adapter添加。。至于adapter,你可以说在里面定义textview,imigeview之类的。protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState)
ViewGroup vg = new LinearLayout(this)//只要得到一个ViewGroup对象就可以了,一般来说是布局view
setContentView(vg) //设置
for(int i = 0 i<5i++){
TextView tv = new TextView(this)
tv.setText("hahahah")
addView(vg,tv)
}
}
private void addView(ViewGroup vg, View view){//添加View
if(null == vg || null == view)
return
vg.addView(view)
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)