Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要做的是将每个子视图与视图组相关联......在创建子视图的代码中,使用它的元素创建一个新的视图组。这些是自动关联的吗?我希望能够通过按钮或输入数字来更改 EditText 中的数字。
编辑 - 这是 Android/Java。
如果视图在视图组中,则可以使用 getParent:
ViewGroup containter = (ViewGroup)myButton.getParent();
我想你想要这样的东西:
ViewGroup group1,group2; onClick(View v) { if (v.getParent() == group1) ; else if (v.getParent() == group2) ; }