I Have extended View class and override draw method. In draw method I draw rectangle using canvas. but this rectangle is simple I need to show as blow. how can I draw rectangle like shown in below image?
create a Path for the top side using 4 points (moveTo and lineTo) and then draw it with Canvas.drawPath. Do the same for the right side
Here is the link for the HoloGraphLibrary. Just check it.
It has no 3d effect as you want but it has Same ui as you want. You will have to play little to have effect like 3d rectangle.
Try a look and let me know if it do not help you.
Enjoy Coding and All The Best. :)
Related
I really need help.
How can I draw such animation like the one shown in the image?
The ring should be transformed into a solid circle.
I see you comment, you don't need to know the color of background, just draw a ring with canvas.drawArc rather than drawCircle
I've been trying to figure out how to draw a transparent rectangle with rounded corners and border with no avail.
Being new to andengine, I'm wondering if it is possible at all. Can someone please provide some pointers or help with a link to a sample. Wasn't able to find any when searching over the internet.
There already Rectangle class in andengine..
Rectangle rec=new Rectangle(x,y,width,height,....);
For transparency:
rec.setAlpha(0):
Attach to your scene, if you are using rectangle as physics object like used for collision then create box body from PhysicsFactory.createBoxBody();
scene.attachChild(rec);
Instead of using a Rectangle can you use a Sprite. Just create an image in Photoshop or another program, apply some transparency and export as .png. Then just load the image as Sprite.
I am trying to draw something like this http://www.laviny.sk/themes/hzs/images/pocasie/r/r2.png using android XML shape. It is one big triangle (45° on bottom) and one smaller triangle on top of it. I am planing on using it on image like this http://www.laviny.sk/themes/hzs/images/pocasie/r/r0.png. I know that I could use simple png image of this but I want to set its color programatically so thats why I am trying to use android shape.
Is this too complex to be drawn by shape? If not can you please try to guide me a bit because I really dont know how should I approach this problem.
Thanks in forward
Layer-list should be able to do that. The other way is to extend ImageView and draw what you like on a canvas within the onDraw method.
I am drawing a filled polygon on a canvas in android.
canvas.drawPath(path,myPaint);
Now I want to do exactly the opposite: Fill the area outside of the polygon.
how can I tell the paint to fill the outer region - the region which is not covered by the polygon?
simply use
path.setFillType(FillType.INVERSE_EVEN_ODD);
This can be complicated or very simple.
The complicated way:
Create a path exactly like your polygon, except don't close it. The continue that path to the nearest wall. Draw around the walls. Close and fill. In code, this isn't too fun.
The simple way:
Color the canvas. Draw the polygon.
Good luck.
I am working on application in which i am drawing a image on the canvas now i want o draw the second image in that canvas.
for example see the image ......
the first image s looking as follow ....
when i click on some place then it will show as follow
but the other thing which is shown in the image (thymin) it should display as fadein in the canvas
how to do it i am not getting any thing can any one help me .....
That's quite complicated by the sounds of it though not impossible to achieve. I think it would take more than the standard View class to achieve this, more like you would need to use the SurfaceView class where you have greater control over what gets drawn and where and when. If you're not familiar with Android 2D graphics then a good place to start would be here.
For drawing the bitmap, you could use canvasObject.drawBitmap() method of Canvas class. drawBitmap takes a paint object as one of its parameters, you could programmatically vary the alpha value of the paint object to create a fade-in effect. Paint class has a setAlpha(value) method to do this. I haven't tried this out myself but this should work.