Questions tagged [android-graphics]
98 questions
29
votes
3 answers
Drawing a rounded hollow thumb over arc
I want to create a rounded graph that will display a range of values from my app. The values can be classified to 3 categories: low, mid, high - that are represented by 3 colors: blue, green and red (respectively).
Above this range, I want to show…

limlim
- 3,115
- 2
- 34
- 46
12
votes
2 answers
Why path drawn on scaled GLES20RecordingCanvas and simple Canvas has different qualities?
Path drawn on scaled GLES20RecordingCanvas has quality as if it was drawn unscaled in bitmap and then up-scaled.
In contrast, if I create Canvas with backing bitmap and then apply the same scaling transformations to Canvas object I get much superior…

Vsevolod Ganin
- 623
- 8
- 22
6
votes
2 answers
Is there a straightforward way to measure the distance between a point and a VectorDrawable group?
In my Android App I want to know the distance between the point where the user clicks and a specific VectorDrawable group.
I want the distance to a group like blue in the VectorDrawable:

Christian
- 25,249
- 40
- 134
- 225
4
votes
1 answer
change LinearGradient colors ratio dynamically for custom seekBar
I have created a seekbar with a custom LinearGradient drawable. However, I want to be able to change gradient ratio for each color, here I use 3 colors, they get equally distributed if positions is null. What I want, in fact, is to provide width or…

Amir Dora.
- 2,831
- 4
- 40
- 61
4
votes
1 answer
How to Draw Rounded Rectangle in API Level below 21 on a Canvas
I am creating a custom view by extending android.view.View.
Now, I need to draw a rounded rectangle on API level below 21. Android has a built in method name,drawRoundRect(float left, float top, float right, float bottom, float rx, float ry, Paint…

touhid udoy
- 4,005
- 2
- 18
- 31
4
votes
2 answers
Add Button to Graphics Canvas
I was using the answer to this question: Drawing on Canvas and save image in order to create a canvas to draw an image on.
I am currently opening a FragmentActivity called DrawImage when a button is clicked. In this activity I want MyDrawView to be…

lessthanmediocre
- 95
- 2
- 11
4
votes
2 answers
how to make star shape and animate it in android?
I want to make a star shape for my project.
and I searched so, now I can make finally star shape by using canvas.
but next what I want is really really difficult to me. It`s so nightmare.
I tried and searched but nothing works for me.
what I want is…

dontknowhy
- 2,480
- 2
- 23
- 67
3
votes
1 answer
How to create a feedback shader in android AGSL?
I'm on Android 13 (tiramisu) and use the new RuntimeShader API to write a pixel shader in AGSL (Android Graphic Shader Language), in order to use it in a composable as background. So far all works.
Now I want to create a feedback effect, where the…

constanze
- 76
- 9
3
votes
2 answers
How to use AnimatedImageDrawable for showing animated GIFs with a ByteBuffer as source
I am experimenting with the new AnimatedImageDrawable that was introduced in Android 9. I am trying to show an animated GIF, creating the source from a ByteBuffer.
Rendering the GIF using a file as the source works fine.
This code does not…

CF256
- 186
- 1
- 14
3
votes
0 answers
Is there a way to use more than one Libgdx View in a single Activity at the same time?
I am trying to add two AndroidFragmentApplication in the single Activity. But only the last added fragment actually renders on the screen. Other fragment does not show anything. What do i need to do to make both views draw?
I was first trying to…

sourabhgupta811
- 106
- 7
3
votes
2 answers
How to get bitmap of a view?
Ok, so I'll try my best to explain my problem.
I have used this code to get a "screenshot" of my FrameLayout
/**
* Function that takes a screenshot of the view passed and returns a bitmap for it.
*
* @param view {@link View}
* @return screenshot…

Sam Berg
- 189
- 3
- 11
3
votes
1 answer
OpenGL ES 2 (Android) draw bitmap
I'm trying to use the code for decode mp4 video add a bitmap (at x, y position) and encode.
I'm trying to use the Android OpenGL code (ExtractDecodeEditEncodeMuxTest.java) for decode of a mp4 video and add a image every frame (at a specific x,y…

rol
- 31
- 3
3
votes
0 answers
Android: What is the default color bitmap of SurfaceView and how to change it?
In my application I have a Translucent Activity with android:windowIsTranslucent is set to true. Activity contains a FrameLayout to which I programmatically add SurfaceView.
By default SurfaceView is drawing bitmap, as per the Activity background…

Sagar Trehan
- 2,401
- 2
- 24
- 32
2
votes
2 answers
Android : How to iterate through webp frames using android's ImageDecoder
I want to convert the animated webp into gif and I have gif encoder+decoder and webp ecnoder and it is working fine with gifs only. I want to process the animated webp as well so I need to decode the animated webp first and get bitamps for each…

CrackerKSR
- 1,380
- 1
- 11
- 29
2
votes
1 answer
Custom Shape drawing using Path in Android
I am trying to draw a custom shape on a canvas that at present looks like this:
and
here is what I want to achieve:
Along with that, I want the attributes for the RGB borders to be configurable, for ex. should be able to change the stroke width as…

Rahul Shukla
- 1,292
- 9
- 25