---
description: Mobwith 네이티브 광고는  AdPopcornSSP v3.6.2 버전부터 지원합니다.
---

# Mobwith

* mobwith\_native\_ad\_unit\_layout.xml 샘플

```xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    tools:ignore="MissingConstraints,MissingDefaultResource" >

    <FrameLayout
        android:id="@+id/mediaContainerView"
        android:layout_width="300dp"
        android:layout_height="220dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        tools:ignore="MissingConstraints">
        <ImageView
            android:id="@+id/imageViewAD"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />
    </FrameLayout>


    <ImageView
        android:id="@+id/imageViewLogo"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_marginTop="5dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@id/mediaContainerView"
        app:layout_constraintBottom_toBottomOf="parent"
        tools:ignore="MissingConstraints"
        />

    <TextView
        android:id="@+id/textViewTitle"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:maxLines="1"
        android:text="{ Title }"
        android:textColor="#000000"
        android:textStyle="italic"
        app:layout_constraintLeft_toRightOf="@id/imageViewLogo"
        app:layout_constraintTop_toTopOf="@id/imageViewLogo"
        app:layout_constraintRight_toLeftOf="@id/buttonGo"
        app:layout_constraintBottom_toTopOf="@id/textViewDesc"
        tools:ignore="MissingConstraints"
        />

    <TextView
        android:id="@+id/textViewDesc"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:maxLines="1"
        android:text="{ Description }"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="@id/textViewTitle"
        app:layout_constraintRight_toRightOf="@id/textViewTitle"
        app:layout_constraintTop_toBottomOf="@id/textViewTitle"
        tools:ignore="MissingConstraints"
        />

    <Button
        android:id="@+id/buttonGo"
        android:layout_width="60dp"
        android:layout_height="35dp"
        android:background="#ccffcc"
        android:text="바로가기"
        android:gravity="center"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toTopOf="@id/imageViewLogo"
        tools:ignore="MissingConstraints"
        />


    <FrameLayout
        android:id="@+id/infoViewLayout"
        android:layout_width="15dp"
        android:layout_height="15dp"
        android:layout_marginTop="5dp"
        android:layout_marginRight="5dp"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:ignore="MissingConstraints" >

        <ImageView
            android:id="@+id/imageViewInfo"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />
    </FrameLayout>


</androidx.constraintlayout.widget.ConstraintLayout>
```

xml에서 생성한 ui component를 sdk에서 제공하는 <mark style="color:red;">`setMobWithViewBinder`</mark> API를 이용해 아래와 같이 설정해 줍니다.

```java
MobWithViewBinder mobWithViewBinder = new MobWithViewBinder.Builder(R.id.mobwith_native_ad_view, R.layout.mobwith_native_ad_unit_layout)
                .mediaContainerViewId(R.id.mediaContainerView)
                .imageViewADId(R.id.imageViewAD)
                .imageViewLogoId(R.id.imageViewLogo)
                .textViewTitleId(R.id.textViewTitle)
                .textViewDescId(R.id.textViewDesc)
                .buttonGoId(R.id.buttonGo)
                .layoutInfoViewId(R.id.infoViewLayout)
                .imageViewInfoId(R.id.imageViewInfo)
                .build();
        adPopcornSSPNativeAd.setMobWithViewBinder(mobWithViewBinder);
```

{% hint style="danger" %}
MobWithViewBinder Builder 생성 시, <mark style="color:red;">`view id(R.id.mobwith_native_ad_view)`</mark>와 <mark style="color:red;">`layout id(R.layout.mobwith_native_ad_unit_layout)`</mark>는 필수로 넘겨주어야 하며, 그 외 ui component에 대해서는 사용하는 리소스에 대해서만 설정해 주면 됩니다.
{% endhint %}

