mainLayout
=
(RelativeLayout)findViewById(R.id.relaGameZhaiGuoZi)imgApple2
=
new
ImageView(this)imgApple2.setImageResource(R.drawable.app)imgApple2.setId(110)imgApple2.setOnClickListener(this)RelativeLayout.LayoutParams
lp1
=
new
RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT)lp1.leftMargin=30lp1.topMargin
=
100mainLayout.addView(imgApple2,lp1)View类里面有一个findFocus的成员函数,羡圆作用相当于找到以当前View为根的view层次结构中神激,获得当前输入焦点的view
。Android下如何取当前获得焦点的控件的ID
id是个标示符,当你定棚败义了一个<Button android:id="@+id/XX"/>孝搏,后面写程序代码需要定义的这个Button键巧和祥的时候就用R.id.XX调用。欢迎分享,转载请注明来源:内存溢出
评论列表(0条)