Skip to content

Instantly share code, notes, and snippets.

@tonnguyen
Created November 18, 2020 11:56
Embed
What would you like to do?
NativeAdChoicesView adChoiceView = (NativeAdChoicesView) nativeViewHierarchyManager.resolveView(adChoiceViewTag);
adChoiceView.removeAllViews();
View providerView = nativeAdView.mNativeAd.getProviderView(nativeAdView.getContext());
if (providerView != null) {
if (providerView.getParent() != null && providerView.getParent() instanceof ViewGroup) {
((ViewGroup) providerView.getParent()).removeView(providerView);
}
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
adChoiceView.addView(providerView, layoutParams);
}
nativeAdView.setProviderView(providerView);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment