this is somewhat of of difficult to describe issue but I'll do my very best:
I am developing a an android app that uses a custom camera activity. In this camera activity I use create a surface view programmatically and set it to the framelayout (covers full screen) that was defined in the xml layout file.
My question now is, how can I add other elements to the frame layout? Only programmatically? I am asking because as of now I was only able to add other elements programmatically. Elements that i added in the xml layout didn't appear on screen. Is it possible that they are just behind the surface view that i add to the frame layout? If so, would it be possible to bring them to the front?
Thank you guys!
http://developer.android.com/reference/android/widget/FrameLayout.html
"FameLayout is designed to block out an area on the screen to display a single item. Generally, FrameLayout should be used to hold a single child view, because it can be difficult to organize child views in a way that's scalable to different screen sizes without the children overlapping each other. You can, however, add multiple children to a FrameLayout and control their position within the FrameLayout by assigning gravity to each child, using the android:layout_gravity attribute."
Sure, you can add as many buttons and other widgets to the
FrameLayout
you have. Since theFrameLayout
allows stacking of views, the components that you added in the xml file are now behind the View that you added programmatically. Here's how you can create and add widgets dynamically:Edit 1:
There's a trick you can use here:
This happens because: