private void setTiles (int i) {
if (numtiles [num] = getImg2 ();
if (numtiles [num + 1] = getImg1 ();
layout.removeAllViews ();
for (int j = 0; jlayout.addView (tiles [j]);
}
guess.add (i);
int x = tiles [num] getScrollX ();. / / Get the X coordinate
ImageViewint y = tiles [num] getScrollY ();. / / Get the Y coordinate
ImageViewCanvas c = new Canvas ();
Paint g = new Paint ();
c.drawText (i + "", x, y, g);
num + +;
}
}
This is part of the code tiles [], the elements are ImageView,
My idea is to get ImageView of x, y coordinates, and then draw the figure in the corresponding coordinates i,
ImageView also made appropriate modifications, getImg1 () and getImg2 () method was different ImageView
Finally draw in digital
in ImageView
You can see the changes ImageView runtime, but there are no ImageView draw any number,
Originally View class which has OnDraw (Canvas) method, but I am here Activity, this method does not seem
Solving the Canvas class how to use, or if there are other ways in which the ImageView painted figures Activity<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
A custom view, rewritten onDraw and related methods
Reply:
Seeking upstairs heroes
Reply:
Seeking upstairs heroes
Reply:
The specific needs and code issued under, just look at the code a bit Mongolia
Reply:
Canvas c = new Canvas ();
c.drawText (i + "", x, y, g);
The canvas is your castle in the air ah! Certainly not draw
No comments:
Post a Comment