Mintegral

  • mintegral_native_ad_unit_layout.xml 샘플

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mintegral_native_outer_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/white"
    android:textDirection="locale">
    <ImageView
        android:id="@+id/mintegral_native_icon_image"
        android:layout_width="64dp"
        android:layout_height="64dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="10dp"
        android:layout_marginStart="10dp"
        android:layout_marginTop="10dp"
        android:background="@null"
        android:contentDescription="@null" />
    <TextView
        android:id="@+id/mintegral_native_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="84dp"
        android:layout_marginStart="84dp"
        android:layout_marginTop="32dp"
        android:textColor="@android:color/darker_gray"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/mintegral _native_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/ mintegral _native_icon_image"
        android:layout_marginLeft="10dp"
        android:layout_marginStart="10dp"
        android:layout_marginTop="10dp"
        android:textColor="@android:color/darker_gray" />


    <ImageView
        android:id="@+id/mintegral_native_main_image"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/mintegral_native_text"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="10dp"
        android:background="@null"
        android:scaleType="centerCrop" />

    <Button
        android:id="@+id/mintegral_native_cta"
        android:layout_width="wrap_content"
        android:layout_height="35dp"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/mintegral_native_main_image"
        android:layout_marginEnd="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="10dp"
        android:clickable="true"
        android:focusable="true"
        android:paddingBottom="10dp"
        android:textColor="@android:color/black"
        android:textSize="12sp"
        android:textStyle="bold" />

    <com.mbridge.msdk.widget.MBAdChoice
        android:id="@+id/mintegral_ad_choice"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:padding="10dp" />

</RelativeLayout>

xml에서 생성한 ui component를 sdk에서 제공하는 setMintegralViewBinder API를 이용해 아래와 같이 설정해 줍니다.

MintegralViewBinder mintegralViewBinder 
= new MintegralViewBinder.Builder(R.id.mintegral_native_ad_view, R.layout.mintegral_native_ad_unit_layout)
        .mainImageViewId(R.id.mintegral_native_main_image)
        .iconViewId(R.id.mintegral_native_icon_image)
        .titleViewId(R.id.mintegral_native_title)
        .descViewId(R.id.mintegral_native_text)
        .adCallViewId(R.id.mintegral_native_cta)
        .adChoiceViewId(R.id.mintegral_ad_choice)
        .build();
adPopcornSSPNativeAd.setMintegralViewBinder(mintegralViewBinder);

MintegralViewBinder Builder 생성 시, view id(R.id.mintegral_native_ad_view)layout id(R.layout.mintegral_native_ad_unit_layout)는 필수로 넘겨주어야 하며, 그 외 ui component에 대해서는 사용하는 리소스에 대해서만 설정해 주면 됩니다.

Last updated