Android Question Vanishing Views?

DrownedBat

Member
Licensed User
Longtime User
Hi there all,
I'm throwing together a little war game and I'm having an issue. I have a horizontal scroll view I'm using for the mission briefing. I've added an imageview as a background and set the scroll view to encompass it. This works just fine. When I add another imageview (the mission's map), it appears in the designer but not when I run the program. The map is on top of the background via .bringtofront. is there something I'm missing here?
 

stevel05

Expert
Licensed User
Longtime User
It is not possible to add a view to a Scrollview (or HorizontalScrollView) with the designer. If you check, it's parent will be Activity, or another panel.

You can add it using HSV.Panel.addview(...) in code after loading the layout.
 
Upvote 0

DrownedBat

Member
Licensed User
Longtime User
Right on. Interesting note; when I added the imageview in code, both views showed up. The imageview added with the designer appeared after I removed the code for it in the designer. It looks like you can add the view in the designer, dim it, and arrange it in code, but the second you try to manipulate it in the designer, it disappears.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
How have you added the imageview by the designer? Drawable?
I believe that it is the background of the ScrollView (or HorizontalScrollView), of its inner panel.
It is not the same thing that adds views to the panel through code.
 
Upvote 0
Top