Wrox Programmer Forums
|
BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2
This is the forum to discuss the Wrox book Professional Android Application Development by Reto Meier; ISBN: 9780470344712
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2009, 08:09 PM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Use SurfaceView in layout

I have this book and I love it! :)

There is a place in the book (ch.11, page 390, middle of page) where it says and I quote:

"A SurfaceView can be used in exactly the same way as any View-derived class. You can apply animations and place them in your layouts as you would any other view."

But I'm not having any luck doing this with my SurfaceView.

Here is my java code:
Code:
        setContentView(R.layout.takepic);
        //setContentView(camPreview); //set preview as activity content
        camSurface = (SurfaceView) findViewById(R.id.camsurface);
Here is my layout code:
Code:
<SurfaceView android:id="@+id/camsurface"
	 android:layout_marginTop="20dip" 
	 android:layout_width="240px" 
	 android:layout_height="160px" 
	 android:layout_gravity="center_horizontal"/>
If I use the setContentView(camPreview);, my camera preview appears on the screen, but not in my layout.

If I use the camSurface = (SurfaceView) findViewById(R.id.camsurface);, my layout appears, but my camera preview does not show up in the layout, I just get a black area where it shoud be. Can anyone help please?!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Layout Managers ironchef Java Basics 1 October 20th, 2006 05:09 AM
Layout problem roy_mm Reporting Services 1 September 28th, 2006 03:43 PM
Help with form layout djjasonsa Access VBA 1 February 15th, 2005 12:50 AM
layout adflynn Java GUI 0 November 9th, 2004 06:33 AM
Table Layout benskywalker Dreamweaver (all versions) 3 October 22nd, 2003 11:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.