So, I'm trying to make the background to one of my apps look "futuristic." I thought of an idea to make the screen look almost transparent yet have views over it. So, it would look something like this: <a href="http://c2499022.cdn.cloudfiles.rackspacecloud.com/wp-content/uploads/2009/08/window-phone-concept.jpg" rel="nofollow">this. http://c2499022.cdn.cloudfiles.rackspacecloud.com/wp-content/uploads/2009/08/window-phone-concept.jpg</a>
I'm thinking that I can use the camera to capture the background of the phone (without taking a picture, just having the real time view in the background) and then, if possible, place a semi-transparent slightly blurred ImageView over that. Finally, on top of that I can place the other views including the ImageButtons.
So, my question is how would I go about doing this? I have searched but haven't found anything relevant. It must be possible; its just how to do it? I don't expect you to give me all the code as an answer, just if you have any ideas that can help or links or code that can point me in the right direction, it would be greatly appreciated! Thanks!Answer1:
It shouldn't be too hard to get started. There are samples located <a href="http://developer.android.com/training/camera/cameradirect.html" rel="nofollow">here</a> that show you how to open the camera and draw the preview onto a SurfaceView. Since you want to overlay your other Views on top of the camera preview, just make sure that the SurfaceView that you are using for the camera preview is contained inside a FrameLayout (docs located <a href="http://developer.android.com/reference/android/widget/FrameLayout.html" rel="nofollow">here</a>). The FrameLayout lets you insert child views and they are z-indexed using the order they are inserted. Therefore, if you insert your SurfaceView and then insert a Button of some kind it will be z-ordered in front of the SurfaceView and you can set its alpha value so that it can be more or less transparent. All that said, you will have to do some trial and error for how you want to position your views that are being rendered in front of the camera preview because a FrameLayout used on different screen sizes might position the Views differently. Also, I'd stay away from layering too many Views on top of one another because the compositor will have to figure out how to render all of it into a single window which could impact performance.