Like @Douglas Farias says in this post: https://www.b4x.com/android/forum/threads/any-news-about-native-ads-advanced.88100/page-3#post-610000 the native ads advanced will need to use the MediaView. I know that this ads is not release to all users, but it works to some ones. How I can use the...
www.b4x.com
B4X:
Dim images As List = NativeUnifiedAd.RunMethod("getImages", Null)
If images.IsInitialized And images.Size > 0 Then
Dim imgView As Panel = pAdmob.GetView(5) 'example
Dim image As JavaObject = images.Get(0)
imgView.Background = image.RunMethod("getDrawable", Null)
NativeUnifiedAdView.RunMethod("setImageView", Array(imgView))
End If
I get his result:
How I can fit the image instead fill (without distortion)?
I saw this thread, but I don't know how to use it in this code:
Don't use this code. Better solution in B4XImageView (XUI Views) (https://www.b4x.com/android/forum/threads/b4x-b4ximageview-imageview-resize-modes.121359/#content)
I have no experience with the Google adds. The RunMethod indicate that a jump is made to the google Java code class. As far as I can understand for the Google Class information it must be something like the following steps:
First, the referred B4J example is a B4X code. That means that it should work in B4A also. So add the both the Sub routines FillImageToView and the FitImageToView and add the following globals to your code:
B4X:
Private xui As XUI '<------------- Add the XUI library
Private ImgView As ImageView '
One of the two B4X sub routines replace the code:
B4X:
Dim image As JavaObject = images.Get(0)
imgView.Background = image.RunMethod("getDrawable", Null)
NativeUnifiedAdView.RunMethod("setImageView", Array(imgView))
by:
B4X:
Dim bmp As B4XBitmap = xui.LoadBitmap(images.Get(0))
imgView.Background = FillImageToView(bmp, imgView.Background ) ' or FitImageToView
In the guideline polices of Admod I can't use ImageView to renderize main resource (video/image) of the Ad. I can use ImageView only to logo or app icon.
In the panel of this code I can put the MediaView (image or view) and this is the problem:
- How I can fit the image in panel (video resources is fit automatically).