因此,在我的应用程序中,我有一个按钮网格。每一项都设置为 addView(closeVies)
,如果显示了一项,则设置为 removeView(openView)
。我添加的视图包含多个复选框,并且在每个复选框上我还将设置一个 onClickListener。
我已经按照自己的方式工作了,但是有没有更简单或更有效的方法可以完成?
复选框后面会有一个背景,该背景将连接到打开它的任何按钮。我已经想通了,只是还没有实施。
复选框位于
三星移动的
XML 中定义的线性布局中,基本上如下所示:
So, in my application I have a grid of buttons. Each one is set to addView(closedVies)
and then removeView(openView)
if one was displayed. The views that I'm adding contain several checkboxes and on each checkbox I will be setting an onClickListener as well.
I have it working my way, but is there an easier or more efficient way it could be done?
There will be a background behind the checkboxes that will connect to whichever button opened it. I have that figured out just haven't implemented it yet.
The checkboxes are in a linearlayout defined in XML
From Samsung mobile
Here is basically what it will look like:
发布评论
评论(1)
Romain Guy 有几个项目。有一个名为 PhotoStream 的项目,它使用 GridLayout。这有点像 LinearLayout,但我们指定行数和列数。因此,此布局的子级会自动布置为网格。它是您迄今为止所做的一个很好的替代方案。
这是该项目的链接。。这是 网格布局。我建议您查看该项目并查看一下。
There is a couple of projects from Romain Guy. There is a project named PhotoStream that uses a GridLayout. This is sort of like the LinearLayout but we specify the number to rows and columns. So the childs to this layout are automatically laid out as a grid. Its a good alternative to what you have done so far.
Here is the link to the project.. This is the link for the gridlayout. I recommend you checkout the project and take a look at it.