Does anyone know how i can draw programmatically in android something like this (without using opengl)?
Pic
You can use shape drawables (circles and lines) to define elements and then combine them in one drawable with Layer List. All this can be defined in XML.
Related
This is the original vector:
This what normally happen if you stretch a vector along x-axis:
This is what I want to achieve:
I know that I can achieve this by making custom view class or creating separate views. But I want to know if there is any way to achieve this using only resource file something similar to 9-patch but for vector.
What I have now is more like a ring. I would like to set the background outside the circle. Is that possible in xml drawable file? Thanks.
What I have now vs
What I would like to achieve
Looks like there is no easy way to do it in drawable file.
If you want to do it in customized view/layout, you can look at the answers in Draw a transparent circle onto a filled android canvas and Android canvas: draw transparent circle on image. Both work for me.
How to create a cells inside grids in MpAndroidchart library?
Sample Image:
https://i.stack.imgur.com/9fNd2.png
I think your best bet is to change the background of the chart. Since the chart is transparent by default, if you manage to get hold of the background picture like in your image, you could use the drawable and change the chart's background and tinker around with it.
You could use this for your chart:
In your XML : android:background="....." or setBackgroundResource(.....) in your java.
I am currently working on an app where the UI is really important. So, I need to create a Button with a particular shape. I'd like to create one so my UI could look like this :
I saw several tutorials about creating your own drawables, but here my problem is the particular shape of my input. The "L" form bothers me ..
Any idea ?
I keep looking for a solution, and if I find one I will post it here as an answer.
You can either use an image of the shape you required or you can use 2 views places horizontally to each other. The first view will contain the yellow color as background with rect footstep image and another view with half of the height of first one having yellow background will be on the right of the first view.
P.S :
You can always use canvas to create your own views.
___________
|.....|.B....|B...|
| G.|____|.....|
|.....|........|.....|
|.....|.G__|.....|
You can't create a view like this BUT you can create a rectangle View like an ImagView that contains drawable like L. All you have to do is use VectorDrawables. create an SVG Image and then Convert it to a VectorDrawable by using Plugins like SVGVectorDrawable.
here is how to add plugin to your AndroidStudio
After All set the drawable to your Views Background.
Like the image on the right,
I want to treat multiple separated shapes as 1 shape in the color gradient behavior!
Any Ideas?!
That is like four separate squares, so no compound shapes? In any case ShapeDrawable, those SVG-like XML vector drawing tools, with clips at the end.