简体   繁体   中英

How can i create a canvas in a framelayout that is part of a xml layoutfile

I'm a total beginner on Android, I only have some java experience from school. For programing a Game I want to draw on a canvas in a Frame layout, that's part of a xml layoutfile. My java.class should relate to this layoutfile. Is this possible, and if yes, how? I didn't found a solution on the web. best regards, Slarti.

Creating a custom view by extending View class and add that view in your FrameLayout. In your custom view file override onDraw(Canvas canvas) and draw anything on that canvas.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM