How to create two circles of arcs moving by touch in Android - android

can someone please give me advice or instruction how to create custom view, which draws two circles with different (or maybe same) count of arcs, and the most important, enable rotating each circle independently anti/clockwise by touch move? But no moving on center hole.
I think image describe it best
rotating circles

I needed something like this and I can't find a component so I implement one.
A custom view that uses Canvas in onDraw method .
For each wheel you can add a list of String to show in each section and a list of Paint to paint that section .
https://github.com/mehdi-azizi/Nested-Wheels-View/blob/master/NestedWheelApp/app/src/main/java/com/ma/nestedwheels/NestedWheelsView.java

Related

How to draw custom shape in android using canvas in viewgroup

I want to create a shape like this image.
I searched a lot for drawing on canvas with different shapes.
I didn't got anything on StackOverflow or Google.
Here is the link I referred
In this tutorial I got to know how to use the curves with canvas.quadTo();
Android How to draw a smooth line following your finger
How to draw a curve according to a control points list that has more than 3 points
//here i got to know about canvas.cubicTo() method which will give curves from start point to end point with middle point.
I don't have any code to show, so, I need to start from scratch.
I need this to be created as ViewGroup, so that I can add 1 View to this ViewGroup. If I add another View into this ViewGroup then the background should look like this.

Android - How to create circle view with Android?

I am creating a View as below design here (like apple music).
pic 1:
pic 2:
The pink circle with physical interaction and fly. Can you suggest ways to make them?
Indeed, you should take a look at the custom view documentation.
What you should do to obtain such a result is to first override the onDraw() method in order to make your custom drawing inside.
Using the canvas, you will be able to create circle by calling :
canvas.drawCircle(x, y, radius, paint);
In order to make the circles look as you want, just take a look at the Paint documentation.
You can create as much circle as you want (the app efficiency is, of course, affected by the number of circle you draw).
With your custom view, you will be able to handle interactions easily, through the onTouchEvent() and to animate the circle modifying their properties over time.
You need to write own View as documented here https://developer.android.com/training/custom-views/index.html and then in your onTouchEvent() check if tap is inside or outside of area you consider checkable (in this case inside the given radius).

android - how to define touchable areas inside a circle

I'm currently trying to create a circle (via canvas drawing, opengl or drawable) and define 4-5 buttons inside of it. My first thought was to create some drawables (quarters of circles) and overlay them onto the main circle, but then I'll have the touchable zone too large - e.g. in the middle of the main circle.
Is there anyone who tried this and found a decent solution to it?
You could just override onTouch() in your custom View that draws the circle (and other button graphics), and do a bit of simple maths when you get the finger down event to determine whether the user has touched within the circle, and what particular defined zone within the circle.

Implementing shapes that can be dynamically changed

Am I approaching this correctly or is there a better way?
I would like to have various shapes such as lines, rectangles, etc, that a user would be able to re-size, rotate, and otherwise change its parameters by clicking on the shape and dragging.
So far, I've implemented this with shapes by drawing the shape into a view and then adding the view onto a layout. A user can then drag that view.
But is this the best way? By doing this, I am manipulating the view that contains the shape and not the shape itself.
Can the shape be re-sized/moved directly through user manipulation?
The best way to draw shapes in Android is extend class from view then draw shapes in onDraw method also you can resize and move shapes using onTouch method dynamically.
Refer this link,
http://www.kellbot.com/2009/06/android-hello-circle/

Android: Draw a moveable and sizeable rectangle on ImageView(Or any other bitmap compatible widget) and crop the selected region

I want to crop my image which is being displayed on an ImageView. How I want to go about it is that I want a re-sizable rectangle to be displayed on the image. That rectangle will have moveable corners (which I can drag around with touch) to increase/decrease its size. The image below illustrates a demo of something I would like to develop.
P. S. I am not quite sure how to phrase my question.
What I want:
http://imageshack.us/photo/my-images/832/customcropbox.jpg/
The final solution I came up with after ample research was:
Extend ImageView to make my own custom view.
#Override onDraw method and do my custom drawing there in that method.
Implement onTouchListener on the view to get the touch events and process them according to their position.
e. g.
I checked whether the touch was in the radius of the anchor point circle I drew around the movable rectangle that I was drawing in my overriden onDraw method.
Edit:
I am sorry guys I don't have that piece of code anymore, I came here after a very long time otherwise would have loved to help you out.
Heartache.

Categories

Resources