Android NativeAd Xml Layout 작성 예시 - bidmad/Bidmad-Flutter GitHub Wiki

Andorid NativeAd Layout 작성 예시

xml에서 정의한 View에게 지정된 Id 값을 사용하여 해당 요소의 광고를 송출합니다.

  • 메인 컨텐츠 미디어 Id : "@id/AD_MAIN"
  • 아이콘 Id : "@id/AD_ICON"
  • 제목 Id : "@id/AD_TITLE"
  • 내용 Id : "@id/AD_BODY"
  • 액션버튼 Id : "@id/AD_BUTTON"
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#ffffff">

    <RelativeLayout
	android:layout_width="match_parent"
	android:layout_height="300dp">

	<FrameLayout
	    android:id="@+id/imageGroup"
	    android:layout_width="match_parent"
	    android:layout_height="200dp">

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

	<FrameLayout
	    android:id="@+id/iconGroup"
	    android:layout_width="55dp"
	    android:layout_height="55dp"
	    android:layout_centerVertical="true"
	    android:layout_alignParentBottom="true"
	    android:layout_marginLeft="10dp"
	    android:layout_marginRight="10dp"
	    android:layout_marginBottom="15dp">

	    <ImageView
	   	android:id="@id/AD_ICON"
		android:layout_width="match_parent"
		android:layout_height="match_parent" />

	</FrameLayout>

	<Button
	    android:id="@id/AD_BUTTON"
	    android:layout_width="50dp"
	    android:layout_height="50dp"
	    android:layout_alignParentRight="true"
	    android:layout_alignParentBottom="true"
	    android:layout_centerVertical="true"
	    android:layout_marginRight="10dp"
	    android:layout_marginBottom="15dp"
	    android:clickable="false"
	    android:textColor="@android:color/white"
	    android:textSize="11dp" />

	<TextView
	    android:id="@id/AD_TITLE"
	    android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
	    android:layout_above="@id/AD_BODY"
	    android:layout_toLeftOf="@id/AD_BUTTON"
	    android:layout_toRightOf="@id/iconGroup"
	    android:ellipsize="end"
	    android:maxLines="1"
	    android:textColor="#000000"
	    android:textSize="15dp"
	    android:textStyle="bold" />

	<TextView
	    android:id="@id/AD_BODY"
	    android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
	    android:layout_alignParentBottom="true"
	    android:layout_marginBottom="20dp"
	    android:layout_toLeftOf="@id/AD_BUTTON"
	    android:layout_toRightOf="@id/iconGroup"
	    android:ellipsize="end"
	    android:maxLines="2"
	    android:textColor="#777777"
	    android:textSize="12dp" />

    </RelativeLayout>
</FrameLayout>