Android :: Possible For A View Having More Than One Canvas?

Aug 26, 2009

I have a View and that has a canvas. I am rotating the canvas, for rotating a bitmap. But after that, I need to draw one more bitmap on the Canvas and, this should not rotate. The second bitmap has to be static.

I tried with matrix rotation for bitmap. But its not rotating in the specified co-ordinates.

Android :: Possible for a View having more than one Canvas?


Android :: View.onDraw() Always Clean Canvas?

Mar 11, 2010

I am trying to draw an animation. To do so I have extended View and overridden the onDraw() method. What I would expect is that each time onDraw() is called the canvas would be in the state that I left it in and I could choose to clear it or just draw over parts of it (This is how it worked when I used a SurfaceView) but each time the canvas comes back already cleared. Is there a way that I can not have it cleared? Or maybe save the previous state into a Bitmap so I can just draw that Bitmap and then draw over top of it?

View 4 Replies View Related

Android :: Drawing View On My Own SurfaceView / Canvas

Sep 9, 2010

I am using SurfaceView to draw my game on the screen of the phone. Basically now I want to be able to draw Android Views on my View, such as a Button or ListView. I am simlpy getting a Canvas and then I draw on that... does anybody know how to draw AndroidViews (Button, ListView.) on my Canvas?

View 2 Replies View Related

Android :: Difference Between View's And Bitmap's Canvas?

Mar 6, 2009

Can anyone explain me the difference between View's Canvas and Bitmaps Canvas

View 2 Replies View Related

Android : Can I Create A View / Canvas That Is Not Rectangular?

Sep 29, 2010

I have a view that is round and hovering above (-> in z-axis direction coming out of the screen) the main content. When the someone taps the screen I want either the main content to be selected or the view hovering above, when it covers the main view.

So far that works perfectly. I have a round shaped item on a transparent canvas. Meaning you can see everything of the background that is outside of that circle. However, you cannot select it, because it is still the hovering canvas, just with a transparent paint.

Now I'm wondering, to solve this issue, if it is possible to make the view/canvas itself round shaped?

Update

I added an image for better explanation what I try to achieve.

View 2 Replies View Related

Android :: Draw A View On A Canvas By Giving X , Y Postion?

Sep 29, 2010

How can i draw a view on a canvas by giving the x,y position in the canvas.

For example,
I have custom view myView, which was created by inflating one of my layout.xml file.
Now i want to draw this myView on the canvas at position (x, y).

How can i do that? code...

View 1 Replies View Related

Android :: Canvas.drawBitmap Somehow Shows Up Behind View / Explain This?

Apr 4, 2010

I called canvas.drawBitmap to draw an image, but somehow it's showing up behind/underneath the custom view (or it's background). can someone explain this?

View 1 Replies View Related

Android :: Drawings Of View.onDraw Not Shown When Canvas Rotated

Mar 7, 2010

I have create a subclass of View and overwritten onDraw() - see some test code below. It draws a line consisting of some points. Before the line is drawn the canvas is rotated and restore after the drawing. The angle by which the canvas is rotated increases by 5 degrees every time onDraw() is called. The view is invalidated about once a second causing the view to be redrawn. Due to the rotated canvas the line drawn looks like a clock hand rotating counter-clockwise. This works - but not always. Sometimes the line is not drawn for one or more seconds, although I know from the log statement that onDraw() was called. Sometimes means: The line may be not shown after 8 seconds, then again after 35 seconds and so on. If the canvas is not rotated the problem does not occur. This also happens when I use a SurfaceView instead of a View. It does not only occur in the simulator but also on my G1 - both using Android 1.6.

CODE:.............

View 2 Replies View Related

Android :: Drawing Text In Custom View Using Canvas.drawtext

Jul 19, 2010

I am drawing text in my custom view in android using canvas.drawtext. i need to change back color, and want text right aligned. for example i want to print the text in a 10, 10, 100, 20 rectangle of color yellow and text color red and right aligned. how can i do that ?

View 2 Replies View Related

Android :: One View Displays Multiple Canvas - Back Button Doesn't Work

Apr 7, 2010

I have a views on the main class and many other class with an onDraw() method to draw a canvas.

Java:

CODE:.....................

View 3 Replies View Related

Android :: Reset Canvas - Draw A New Bitmap Into The Canvas

Jul 7, 2010

My loadMap() method generate a canvas.throwIfRecycled exception when i try to load a new map.
When i start the game, the initial map loads and work fine though,
its only when i try to load a new map that i get the exception ..

How can i "reset" canvas and the bitmap i use to draw into, so i can startover fresh with them ?
here's what i use to create and draw my maps:

CODE:.........

So basicaly once i created and used picDest and canvas, i cannot figure how to reset it all for when i want to load a new map..

View 1 Replies View Related

Android :: Populate View Flipper Child View With List View?

Aug 2, 2010

I am trying to set up a ViewFlipper that changes a SlidingDrawers content each time a button is pressed. So far every view I set up worked fine, but now I am trying to create a ListView (including single_choice_mode) within a child view of the ViewFlipper, but my attempt only let to a NullPointerException. As I only discovered ViewFlipper today, I am not yet familiar with it and may not have understood it completely. if someone could give me a hand and help me find out what I have done wrong, that would be great. Here is what I have done:

The code for the onClick event of the ImageButtons:
public void onClick(View v){
if (v == btnExposure){
mFlipper.setDisplayedChild(0); }
else if (v == btnProperties){
mFlipper.setDisplayedChild(1);}
else if (v == btnSpecialEffects){
mFlipper.setDisplayedChild(2);.............

View 1 Replies View Related

Android :: Transparent Canvas

Apr 4, 2009

I'm trying to make an app that requires me to draw over a layout with buttons, etc. I want to build a transparent canvas over the current layout and draw onto that canvas. How is this done?

View 3 Replies View Related

Android :: Draw From Old Canvas

Oct 28, 2010

I'm making an App that needs to be able to draw new graphics on top of the last set.

This is my current onDraw() method -
protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.WHITE);
if(points.size() > 0) {
//do some stuff here - this is all working ok
canvas.drawLine(p1.x, p1.y, p2.x, p2.y, linePaint);
}
}

Basically, I need to draw the new graphics as a layer on top of the last, so what I'm looking for is a way to carry the image of the last canvas to the current. I have tried to figure it out myself using the canvas.setBitmap() method but it acts very funny.

View 2 Replies View Related

Android :: Copy From One Canvas To Another?

Oct 4, 2010

I want to copy the image drawn in one canvas (details) into another canvas. The commonly discussed solution of using bitmaps will not work because the Bitmap class does not have many of the important methods belonging to the Canvas class.

View 1 Replies View Related

Android :: OpenGL ES Canvas ?

Jun 13, 2010

I'm working on an OpenGL ES game using the NDK. My min SDK version is 1.6. I have created an OpenGL Es 1.0 renderer in Java and am calling a native JNI method in that renderloop.

The problem I'm having is that it seems that the resolution of the rendering context is limited. When using the emulator I'm getting a rendering canvas of 480x320, which is fine. Now; when I use my HTC Desire I am only getting a canvas of 533x320 while the native resolution of this phone is 800x480px.

View 2 Replies View Related

Android :: Canvas.drawText ?

Apr 16, 2010

I have a view, I'm drawing with the Canvas object in the onDraw(Canvas canvas) method.

My code is:

CODE:....................

The problem is the text doesn't show through the background, what am I doing wrong? If I remove the canvas.drawPaint(paint) and paint.setColor(android.R.color.black) you can see the text on the screen.....

View 2 Replies View Related

How To Write On Canvas In Android

Mar 25, 2013

How I can show keyboar to write like text on canvas by soft keyboad?

View 4 Replies View Related

Android :: Save Canvas To Disk

Sep 22, 2009

I am doing a painting program (KIds Paint - you can find in Android Market) and I have a lot of requests to save the content on disk or to wallpaper. I have been searching around but cannot find solution. My guess is that I probably wanted to get the bitmap from the canvas, but I can't find ways to get it. Then I try to set an empty bitmap into the canvas and draw on the canvas, and save the bitmap... but I got an empty bitmap..........

View 7 Replies View Related

Android :: Converting Canvas To Drawable?

Sep 5, 2009

Is it possible to convert a Canvas to Drawable?I may be really off in my solution, so if you have a better suggestion, please do tell me. This is what I'm trying to do.I'm trying to create a custom RadioButton. to set different states of the radio button, I need to use this parameter and one of the parameter to addState is Drawable. I know I can easily provide an image file and use it as a Drawable, but I want to do some image manipulation to the image before using it.There is a tutorial in ApiDemo called AlphaBitmap. It uses the onDraw method of a View to change a PNG file to full red and draw something with a gradient. So I customized it to shade an icon with gradient. So the problem now is that this is a View, and the View works perfectly fine if I add this View to the main view. But i want to convert this View to Drawable so I can use it as one of the parameter in addState. What I really want to achieve is to have different colour shades for different state of the RadioButton without providing different images to do so.

View 6 Replies View Related

Android :: Path Appearing Twice On Map Canvas

Sep 14, 2010

I have a Main_Overlay class that extends Overlay. I added This overlay to the mapview and override the Draw method as of below:....................

View 5 Replies View Related

Android :: Draw Text On Canvas?

Oct 28, 2010

i'm trying to develop a simple pie chart class for android. For now, it can take a map of labels and values and draw the pie chart. I'm yet to add the legends for the pie, which is where i need to place the texts near small rectangles on the screen corner. Any help appreciated, since i'm new to Android dev.

View 1 Replies View Related

Android :: Put Button And Circle On Same Canvas

Sep 2, 2010

I have a question that I wanted to put button and circle on the same canvas. How can I do this? Please give reply as soon as possible.

View 2 Replies View Related

Android :: How To Repeatedly Draw On A Canvas?

Sep 7, 2010

My requirement is to draw a line on canvas for every second. I am able to draw the line but its clearing the previously drawn lines when I call myview.invalidate(). Now my question is how to draw a new line retaining all the previously drawn line on the same canvas.

View 5 Replies View Related

Android :: Unable To See Bitmaps At 0 0 Of Canvas

Jul 6, 2010

I have following example code:

Character c = CharacterFactory.getCharacter(CharacterEnum.SpecialCharacter); //factory has applicationContext reference to get bitmaps from R. ... Paint bitmapPaint = new Paint(); ... View::onDraw(Canvas canvas) ... canvas.drawBitmap(c.bitmap(), 0, 0, bitmapPaint);

For some reason (must be something simple) I do not see the bitmaps at the 0,0 of the canvas. Inspecting the bitmap and etc does not show anything obvious (nulls), I must have missed something. Is there something I should be paying particular attention to while drawing bitmaps?

View 5 Replies View Related

Android :: Smoothing Out Line On Canvas

Sep 3, 2010

I'm trying to draw out a race track in a map overlay. I have a series of locations that define the track. I have the drawing working fine just using canvas.drawLine() from one point to the next. But, understandably, this looks kind of choppy. Is there a decent way to smooth the line out?

View 3 Replies View Related

Android :: Compare Bitmaps In Canvas

Aug 18, 2010

I am using the above code for displaying bitmap.and i also move that bitmap.Now my qusetion is how i am compare bitmap with another bitmap. Please give me some suggestions.

View 2 Replies View Related

Android :: Canvas Faster Than OpenGL?

Dec 20, 2009

I have downloaded and run the SpriteMethodTest on my Droid but compiled to 1.6 Android. I am getting the very strange behavior that drawing bitmaps to *canvas* is faster than using OpenGL. At 100 sprites, I am getting about 64 fps for Canvas. For OpenGL, its around 34 fps.

I also ran the same test on the 1.6 emulator. 100 sprites came in at 30 fps for canvas, just 6 for OpenGL!

I was so astonished that I actually checked that the radio buttons were running the right tests.

View 2 Replies View Related

Android :: Can't Add 3 Images In A Canvas In Droid / Way To Do

Mar 10, 2010

I have 3 images that I want to add one after other on a canvas.
This is my code...

but this is not working.

Can someone please tell me what I am doing wrong here.

View 1 Replies View Related

Android :: Drawable Cannot Draw Into Canvas / What To Do?

May 26, 2009

I want to load an icon from resource and draw over it. But I cannot get it into a canvas. Can anyone please help me with the code below. If I uncomment c.drawColor(), I get blue color as expected. So the problem is on icon.draw(). code...

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved