3

Possible Duplicate:
add and remove views in android dynamically?

In Iphone, the view is added or remove by using addsubview or removefromsuperview. What about in Android, how do you add or remove a view?

fundamental questions, I am trying to clear up my concepts.

thanks

Community
  • 1
  • 1
lilzz
  • 5,243
  • 14
  • 59
  • 87
  • Take a look at [Add and Remove Views in Android Dynamically](http://stackoverflow.com/questions/3995215/add-and-remove-views-in-android-dynamically) and [Add Delete View From Layout](http://stackoverflow.com/questions/3805599/add-delete-view-from-layout). – Ryan Wersal Jan 09 '12 at 22:15

1 Answers1

3

You seem to understand programmatically adding and removing views in iOS

In android, you cannot necessarily add a view to a view. You will need a subview of the Class ViewGroup (RelativeLayout,FrameLayout...) that you can add views into.

You can use

void android.view.ViewGroup.addView(View child)
void android.view.ViewGroup.removeView(View view)

There are more ways to add and removeView, but the important part is that you look up the reference for ViewGroup. Android layout is a whole different cup of tea compared to iOS layout.

Jesse Black
  • 7,966
  • 3
  • 34
  • 45