Skip to content

Instantly share code, notes, and snippets.

@tonnguyen
Created November 18, 2020 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonnguyen/3548099fb3cc90d62898a428fedf7082 to your computer and use it in GitHub Desktop.
Save tonnguyen/3548099fb3cc90d62898a428fedf7082 to your computer and use it in GitHub Desktop.
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