Questions tagged [ondraw]

onDraw is an event that is used in multiple languages/frameworks to notify the application that something needs to be (re)drawn.

onDraw is an event that is used in multiple languages/frameworks to notify the application that something needs to be (re)drawn.

The exact implementation and usage is depending on the framework implementation

Examples are:

662 questions
-1
votes
1 answer

Android Custom View drawing got bad quality

I'm overriding View on Android to do some custom drawing, but the rendered view has not very good quality, especially the text. I have found a couple of solutions, but none worked for me. Attaching the code here. Thank you for any help. @Override …
Anhayt Ananun
  • 896
  • 1
  • 11
  • 27
-1
votes
1 answer

I need to make a particle animation but the particles always start from pixel 0,0

This is the animation that I need to make: https://www.dropbox.com/s/xvyj550i43gg6wz/2015-08-24%2013.12.57.mp4?dl=0 I started working on it, using the Leonids library: https://github.com/plattysoft/Leonids Now I made a particleSystem creator, and I…
rosu alin
  • 5,674
  • 11
  • 69
  • 150
-1
votes
1 answer

Use Canvas to draw thousands of Rects

I am trying to make a native Android version of http://arapaho.nsuok.edu/~deckar01/Zvis.html So, I made a custom View that draws all the squares needed. Of course, this drawing ends up taking 10s of seconds once the number becomes large enough to…
-1
votes
1 answer

How to get Width and height of item in the drawable?

I am trying to declare and initialize a variable globally as final, this variable should holde thewidth and the height of an element in the drawable, how to achieve that. I want smothing like the followinf "ofcourse it is not working, but it is…
Amrmsmb
  • 1
  • 27
  • 104
  • 226
-1
votes
3 answers

Create custom View object

I want to create custom View that paint circle on screen. But constantly getting some errors. Is it OK if I don't put any initialization in CustomView constructor? Or what data should initialize there? This is my code witch doesn't work: package…
Matjaž
  • 2,096
  • 3
  • 35
  • 55
-1
votes
1 answer

Android: Displaying Bitmap

I kind of asked this project before, but I have come across new problems and new ideas I want to share. I am trying to draw a multitude of the same graphic randomly spaced. Here is the first activity code that transitions to the second activity…
user963070
  • 629
  • 2
  • 19
  • 24
-1
votes
1 answer

Android How to draw a custom view

I got this picture i need to implement as a footer for a app(the circle and the 2 rectangles will act as a independent button each), but i only have this picture and the pictures that need to enter inside the 3 shapes, whats the best way to…
nairdat
  • 179
  • 1
  • 3
  • 10
-1
votes
2 answers

provide circular motion for a custom drawing on touch: Android

I have a custom drawn rectangle which i want to move in a circular path based on touch events. It follows the direction of the touch for clockwise or anticlockwise movement but basically move in circular motion, as if moving on the edge of the…
Sunny
  • 7,444
  • 22
  • 63
  • 104
-1
votes
1 answer

draw a cursor for a controller using MFC

I'm writing a MFC program that has a mouse-like controller connected. The controller itself has callback function that I can get the position of it, but I want to draw a cursor for this controller that I can see where it is in the window. There is a…
user1964417
  • 1,675
  • 4
  • 17
  • 26
-1
votes
1 answer

Adding in an int variable inside the onDraw with a class to handle the if statement

I am trying to insert the current suit but in the form of text near the users current score. I created the following: private int currentSuit = 0; I have entered the following in the onDraw section: canvas.drawText("Suit: " + (currentSuit), 300, …
Karrbs
  • 3
  • 3
-1
votes
1 answer

my android application works good on my emulator but in the device is crashed

When I run my application in the emulator it works well, but in my device it crashed. When I open my activity and call the ondraw method I figured that the Invalidate(); is the problem: protected void onDraw(Canvas canvas) { // TODO…
-1
votes
2 answers

how I can slow grind down the line in android?

I mean I want to drawline but slowly. I write this code to draw line in ondraw method. . . . . caneta.setARGB(255, 255, 0,0);caneta.setStrokeWidth(10); canvas.drawLine(0, ys * 1/2, this.getWidth(), ys * 1/2, caneta); . . . how I did it slowly? …
CompEng
  • 7,161
  • 16
  • 68
  • 122
-2
votes
1 answer

Android ImageView setImageBitmap or draw bitmap in canvas

I have 40 instances of my custom ImageView (added programmatically to my layout) that eval their size dinamically (according to display size in pixel). Is it better to call myCustomView.setImageBitmap or override onDraw and draw bitmap in…
javaman
  • 57
  • 8
-2
votes
1 answer

android java passing data from view to activity

i'm starting with drawing in android. I have simple activity with only onCreate method: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set full screen view …
Damian Drewulski
  • 134
  • 1
  • 3
  • 11
-3
votes
2 answers

Get context in xml for "onDraw" in a custom view

I want to load an image from url in onDraw method for the view preview. I tried to do this using Picasso. But, I get an error in the xml. This is the onDraw method. @Override protected void onDraw(Canvas canvas) { this.canvas = canvas; …
Sambhav Khandelwal
  • 3,585
  • 2
  • 7
  • 38
1 2 3
44
45