Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Dim bmpBackground As Bitmap
Dim bdwBackground As BitmapDrawable
Activity.LoadLayout("fTstButton")
' I know it would not work, but it is to illustrate what I wanted to do.
bmpBackground.Initialize(btnTeste.Background) ' <== PROBLEM HERE!!!
bdwBackground.Initialize(bmpBackground)
If Activity.Width>Activity.Height Then
' Button is Square
bdwBackground.Gravity = Bit.OR(Gravity.TOP,Gravity.CENTER_HORIZONTAL)
btnTeste.Gravity = Bit.OR(Gravity.BOTTOM,Gravity.CENTER_HORIZONTAL)
Else
' Button is Rectangular
bdwBackground.Gravity = Bit.OR(Gravity.CENTER_VERTICAL,Gravity.LEFT)
btnTeste.Gravity = Bit.OR(Gravity.CENTER_VERTICAL,Gravity.RIGHT)
End If
btnTeste.Background = bdwBackground
End Sub