Devon Smith
Devon Smith

Reputation: 397

Android Canvas layout

I was using XML to create layouts for my application but recently I found that layouts can also be created with the help of canvas using surface View so I wanted to know whether it is advisable to create a layout with the help of canvas or not?

Upvotes: 0

Views: 464

Answers (1)

Peter Knego
Peter Knego

Reputation: 80340

You can use Canvas to draw things on it, like lines, circle, text and bitmaps. However you can not add Widgets to it.

So yes, you could use Canvas to create Ui, but you would have to do everything from scratch, basically reimplement needed Widgets. This is what games usually do, but its impractical for "normal" projects, especially if you need complex Widgets like ListView.

Upvotes: 1

Related Questions