I am following two google sample repositories to compare the behaviour of
Native Ad Express and
Native Ad AdvancedI just checked out the projects and imported to Android Studio with no changes.
The attached screenshots is the outcome of what I'm getting. Notice that AdChoicesView (right top corner) is slightly different.
For Native Express (see navExpress.png) it's contains two icons "i" and "x", but in Native Advanced (see navAdvanced.png) there is no "x" (responsible for closing ad).
I believe, in Native Express code we don't have much control over the views, so the code there is pretty straight forward.
Unlike in Native Advanced code, where we are setting all the views explicitly:
adView.setHeadlineView(adView.findViewById(R.id.contentad_headline));
...
adView.setAdvertiserView(adView.findViewById(R.id.contentad_advertiser));
then a value for them:
((TextView) adView.getHeadlineView()).setText(nativeContentAd.getHeadline());
...
((TextView) adView.getAdvertiserView()).setText(nativeContentAd.getAdvertiser());
and assigning the ad to the view (whatever it means :)) :
adView.setNativeAd(nativeContentAd);
On the attached screenshot for layout inspector I see that there is a FrameLayout injected in case of Native Advanced Example, and there is only one image, for "i" icon (see adViewLayout.png).
Moreover, in my project the AdChoices icons don't appear at all. What are the rules to get it appear on my layout?
Is there something additional I need to do in order to get the close to Native Express behaviour?
I was trying to reinvent the wheel by adding AdChoicesView to my FrameLayout:
<com.google.android.gms.ads.formats.AdChoicesView
android:id="@+id/ad_choices_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="top|end">
</com.google.android.gms.ads.formats.AdChoicesView>
and then set it within the setter:
adView.setAdChoicesView((AdChoicesView) adView.findViewById(R.id.ad_choices_info));
But no luck.
Could you please guide me on that. Thanks
----
Max