I'm trying to use a FrameLayout
as the content of a Live Wallpaper. According to this answer by Romain Guy, it should be possible, but I didn't have much luck calling .measure()
and .layout()
on the view. Could anyone give me a brief example of how to use a regular layout inside a Live Wallpaper?
It's a wallpaper that you can mess around with, right? If you are going above the usual views, you may have to implement some custom logic, especially if you are drawing images. A FrameLayout has background and foreground drawable functions. You can use XML or Java to add regular views into a FrameLayout
You also can create a custom Drawable object to do a lot of fun things with regards to custom painting. The Drawable object simply gets sent the view's canvas.
If you want to measure views, you are going to have to do it after the view runs through its measure and layout codes. This means doing this in onCreate() returns 0. Lots of people have had better luck doing it in a callback like onWindowFocusedChanged
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With