Still have not figured this one out.  From the post I viewed on this
forum, it appears that when I extend View and setContentView(new
MyView(this)), there is a problem getting the size of the screen space
available for Canvas drawing functions, not including title bars,
keyboards etc..

So I have been pursuing xlm layout files with a surface view for my
Canvas Drawing functions and a linear layout for my buttons.
Unfortunately almost all the Android Graphic samples extend View and
setContentView(new MyView(this)).

As far as I can tell I want to do something thing like

    setContentView(R.layout.main); Where main has a LinearLayout with
a SurfaceLayout and another LinearLayout for my buttons.

then get my SurfaceView with

   SurfaceView DrawingSurfaceView =(SurfaceView)
findViewById(R.id.DrawingSurfaceView);

And that is where I get lost.  When the Android Graphics samples
create a class to extend View, they override onTouchEvent to get Up,
Down and Move events, and OnDraw to get the canvas and paint on it.

So once I get my surface view using

   SurfaceView SurfaceView =(SurfaceView)
findViewById(R.id.DrawingSurfaceView);

1. How do I get the canvas from the SurfaceView so I can draw on it,
or do I assign a Canvas to the SurfaceView and draw on it?
2. Do I need to override OnDraw or can I just use Canvas draw commands
to draw on the canvas when a onTouchEvent or some other event occurs?
2. How do I override the onTouchEvent for just the SurfaceView?

Thanks!

On Dec 30 2011, 6:16 pm, JamesColeman
<[email protected]> wrote:
> Hello;
>
> This is my first post here.  I am a BlackBerry developer trying to
> move to Android before my BlackBerry sales totally dry up.  I gone
> through many samples and have read quite a few post about the subject
> of determining the size of the area I have to perform GraphicsActivity
> commands, title bar height, etc.  I feel even more lost now.  I am
> hoping someone will not mind helping me out to find the proper path to
> head down.
>
> I want to be able to display; the systems title bar, my applications
> title bar, a drawable "canvas" for Android.graphics.Canvas functions,
> and buttons at the bottom of the screen.
>
> The GraphicsActivity and Android.graphics.Canvas functions look like
> the ones I want to use. However, I have run into a few road blocks and
> concerns.
>
> 1.  The only samples I have found so far that use GraphicsActivity use
> setContentView(new MyView(this)).  I have not found one that uses an
> XLM layout to deal with different screen sizes and buttons.
>
> 2.  If I use do a custom View using  setContentView(new MyView(this)),
> I have not found a way to get the size of the area I have available
> for the Graphics Activity/Canvas functions, which is the screen size
> minus the size of the system title bar and my title bar.   I have
> found several post on" title bar/screen size" and they seem to have
> gotten into some heated discussions with no resolution. Therefor I
> have no way of knowing the size of the area for the Canvas functions
> is.  This brings up several concerns.
>     1.  How I can place my buttons at the bottom of the screen if I am
> using setContentView(new MyView(this)) in liue of the XML layout files
> or how can I use XML layout files with the GraphicsActivity?
>     2.  How can I scale a bitmap to the size of the view available for
> the Android.graphics.Canvas functions if I do not know the size of the
> area it is going in.
>
> My only other concern at this point is weather or not I can save the
> resulting Canvas to a picture file like a Jpeg.  However, I have not
> researched this issue yet.
>
> Can someone point me in the right direction for accomplishing my goals
> of:
>
>      1.   Display the System title bar, my title bar, a row of buttons
> at the bottom of the screen and the rest of the space is used for the
> Android.graphics.Canvas functions.  I will need to be able to
> determine the dimensions of the area used for the
> Android.graphics.Canvas functions so I can draw objects and scale
> them. Ultimately I would like to save the final "Canvas" to a Jpeg
> file.
>
> Thanks for the assistance!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to