Native Ad Scroll View

Creates a native ad horizontal scroll view for a given native ads manager and native ad template. The manager can be preloaded with ads, and loadAds will use the preloaded ads from the manager. Otherwise, the scroll view uses the manager to load ads normally.


Before you start, if you haven't done so yet, follow the steps in our getting started guide to set up the SDK.

Initialize the Audience Network SDK and load ads via the native ads manager:

public void onCreate(Bundle savedInstanceState) {

    manager = new NativeAdsManager(this, "YOUR_PLACEMENT_ID", 5);

 public void onClick(View v) {

Render NativeAdScrollView by providing a loaded NativeAdsManager and a native ad template or publisher defined UI View via the native ads api:

public void onAdsLoaded() {
    Toast.makeText(this, "Ads loaded", Toast.LENGTH_SHORT).show();

    if (scrollView != null) {
        ((LinearLayout) findViewById(;

    scrollView = new NativeAdScrollView(NativeAdHscrollActivity.this, manager,

    ((LinearLayout) findViewById(;

The native horizontal scroll view is preloaded with 5 ads. However, you can load the scroll view with more ads by defining a max ad parameter to the scroll view constructor.