I use this code to set a image in native ad advanced.
The logoView is a panel and the background is set to FILL automatically. This is the result.:
How I can set the BitmapDrawable with gravity = CENTER ?
I try this:
but I get this error:
Thanks in advance for any tip.
B4X:
Dim images As List = NativeContentAd.RunMethod("getImages", Null)
If images.IsInitialized And images.Size > 0 Then
Dim image As JavaObject = images.Get(0)
logoView.Background = image.RunMethod("getDrawable", Null)
NativeContentAdView.RunMethod("setImageView", Array(logoView))
End If
How I can set the BitmapDrawable with gravity = CENTER ?
I try this:
B4X:
logoView.SetBackgroundImage(image.RunMethod("getDrawable", Null)).Gravity = Gravity.CENTER
B4X:
java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable cannot be cast to android.graphics.Bitmap
Thanks in advance for any tip.