【发布时间】:2011-08-06 05:22:28
【问题描述】:
Android 视图在 xml 文件中,我们可以将 n 个拖放控件拖到其中,但是现在我想在 java 中的 while 循环中创建图像和链接按钮,这意味着我们必须从后端开发界面部分,如何我们这样做?
【问题讨论】:
-
很好。你能解释一下你做了什么吗:)
标签: java android android-layout android-widget
Android 视图在 xml 文件中,我们可以将 n 个拖放控件拖到其中,但是现在我想在 java 中的 while 循环中创建图像和链接按钮,这意味着我们必须从后端开发界面部分,如何我们这样做?
【问题讨论】:
标签: java android android-layout android-widget
ImageButton inherits from ImageView and has its own properties compared to Button properties.
you can check properties here,
http://developer.android.com/reference/android/widget/ImageButton.html
Make your activity implement OnClickListener, then in OnCreate() or after that event. use ,
ImageButton btn = new ImageButton(this); or
//ImageButton btn = (ImageButton) findViewById(R.id.imgbtnid)
btn.setOnClickListener(this);
in onClick() function you can handle the click event
【讨论】: