Dev.7arooney Dev.7arooney -4 years ago 88
Android Question

Have an explanation in Android to Draw a circle

I just created a simple POS for restaurant and in this project I have created a simple grid view like thisGridExample
This grid view which contains a table is blue and there are 3 texts in this grid, by the way I put this tables as an image. I want to draw tables with a shape of circles, consists of 2 shapes of circles the bigger one is the table and the others is just a small circles surrounded with the big circle, as every table should have a specific number of chairs which was the small circles one as getting with number of chairs from the data base for an example there's a table contains 4 chairs or 3 chairs or even 5 chairs....etc. what is the best way to draw this circles? By Canvas? or draw through drawable.xml file? these tables and chairs should be in a relative or linear layout having getter and setter class, and having also an adapter class.

Answer Source

Easiest way is to include each variation as a separate image and just use image views with a TextView on top for the number. If you don't want to do that, you're talking about a custom View, overriding onDraw, and drawing by hand. Xml drawables aren't really good for anything this complex.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download