Question

Ok I do have a question regarding how I would implement this function:

I am creating an application, and in one activity, I want to display several information in the upper half of the screen. Now if I want to display an image, I chose ImageView, if I want to display text, I use TextView, and so on. The user choses what do display in the activity that comes before the display-activity.

Now my question: What kind of View do I chose for this? I was thinking about a WebView, to display images or text. But there is also a chance that I have to display a player for a .wav-file. Does WebView also provide this function? My Problem is that I cannot just say that I chose an ImageView, because it displays no text, and so on. I need a container that can display everything.

Or is there a possibility to overlap like 3 different containers, and activate only the one that I need?

Was it helpful?

Solution

You can have all 3 views in the layout and use Visibility.GONE to hide the ones you don't want. Or you can dynamically add a insert a view at runtime. A simple way to do this second solution would be to put a placeholder view there in your XML layout, and at runtime remove this view and dynamically insert your desired view in it's place.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top