我如何添加和删除的意见,如的TextView
- 从Android应用程序像原来的股票Android的联系人屏幕上,您preSS右侧的小图标现场的一侧,并将其添加或删除它由的TextView
和 editTextView
(从我可以现场见)。
How do I add and remove views such as TextView
s from Android app like on the original stock Android contacts screen where you press a small icon on the right side of a field and it adds or deletes a field which consists of a TextView
and an editTextView
(from what I can see).
这是如何实现这一点任何的例子吗?
Any examples on how to achieve this?
推荐答案
从this螺纹对Android的开发者来说,接缝的ViewParent和的ViewGroup,一般无法删除的意见。你需要转换你的父母到布局(如果它是一个布局)来完成你想要的东西。
From this thread on android-developers, it seams that ViewParent and ViewGroup in general can't remove views. You need to cast your parent to a layout (if it is a layout) to accomplish what you want.
例如:
View namebar = view.findViewById(R.id.namebar);
((ViewGroup) namebar.getParent()).removeView(namebar);
相关推荐
最新文章