I\'ve got a problem which I don\'t know how to solve. Please, help me if you can. In my app I have to create a custom view extended View. In this view I should draw a lot of
You can load and use the XML defined drawable from code like so:
public class CustomView extends View {
Drawable shape;
public CustomView(Context context) {
super(context);
shape = context.getResources().getDrawable(R.drawable.shape);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
shape.setBounds(left, top, right, bottom);
shape.draw(canvas)
}
// ... Additional methods omitted for brevity
}