AdPopcorn

AdPopcorn(IGAWorks) 네이티브 미디에이션 레이아웃 구성

미디에이션 설정

AdPopcorn(IGAWorks)는 기본 제공으로 별도의 미디에이션 연동 작업이 필요하지 않습니다.


Layout

레이아웃 구성 샘플(native_ad_unit_adpopcorn.xml)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/native_unit_adpopcorn_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#FFFFFF"
    android:gravity="center"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="#FFFFFF"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/native_unit_adpopcorn_icon_image"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_margin="10dp" />

        <LinearLayout
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:orientation="vertical">

            <TextView
                android:id="@+id/native_unit_adpopcorn_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#000000" />

            <TextView
                android:id="@+id/native_unit_adpopcorn_desc"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:maxLines="2"
                android:textColor="#000000" />
        </LinearLayout>

        <TextView
            android:id="@+id/native_unit_adpopcorn_cta"
            android:layout_width="60dp"
            android:layout_height="30dp"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="25dp"
            android:layout_marginRight="10dp"
            android:background="#3d7caf"
            android:gravity="center"
            android:textColor="#ffffff"
            android:textColorHint="#ffffff"
            android:textSize="16sp" />
    </LinearLayout>

    <ImageView
        android:id="@+id/native_unit_adpopcorn_main_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</LinearLayout>

ViewAdapter

XML에서 생성한 UI Component를 SDK에서 제공하는 ViewAdapter API를 사용하여 다음과 같이 설정해 줍니다.

// NativeViewAdapter
val builder = NativeViewAdapter.Builder()

// AdPopcorn
builder.setAdPopcornViewAdapter(
  viewAdapter = AdPopcornNativeViewAdapter.Builder(
    nativeAdLayoutId = R.layout.native_ad_unit_adpopcorn,
    nativeAdViewId = R.id.native_unit_adpopcorn_container
  )
  .setDescViewId(R.id.native_unit_adpopcorn_desc)
  .setCallToActionId(R.id.native_unit_adpopcorn_cta)
  .setIconImageViewId(R.id.native_unit_adpopcorn_icon_image)
  .setMainImageViewId(R.id.native_unit_adpopcorn_main_image)
  .setTitleViewId(R.id.native_unit_adpopcorn_title)
  .build()
)

// NativeLoader
NativeAdLoader(
  context = ...,
  placementId = ...,
  viewAdapter = builder.build(),
  listener = ...
)

Last updated