123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?xml version="1.0" encoding="utf-8"?>
- <ScrollView 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="match_parent">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <androidx.appcompat.widget.AppCompatButton
- android:id="@+id/btn_load_native_in_recyclerview"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="原生广告在RecyclerView中运用"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
- <androidx.appcompat.widget.AppCompatButton
- android:id="@+id/btn_load_native"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="加载广告"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
- <androidx.appcompat.widget.AppCompatButton
- android:id="@+id/btn_show_native"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="显示广告"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
- <androidx.appcompat.widget.AppCompatButton
- android:id="@+id/btn_load_and_show"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="加载并显示广告"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
- <androidx.appcompat.widget.AppCompatTextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="此处为getNativeAdView, 自定义布局不用写在此界面,通过addView添加到界面中" />
- <LinearLayout
- android:id="@+id/ll_ad_content"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical" />
- <androidx.appcompat.widget.AppCompatTextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
- android:text="原生广告自行加载填充模式,在Xml NativeAdView中设置好配置, View中自动完成加载"
- />
- <com.composition.android.lib.ad.widget.NativeAdView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- app:ad_slot_name="native"
- app:ad_admob_native_ad_view_layout="@layout/layout_admob_native_ad_view_root"
- app:ad_view_title_id="@id/tv_ad_title_1"
- app:ad_view_title_desc_id="@id/tv_ad_title_desc_1"
- app:ad_view_icon_id="@id/iv_ad_icon_1"
- app:ad_view_media_content_group_id="@id/fl_ad_media_content_1"
- app:ad_view_call_to_action_id="@id/btn_call_to_action_1"
- >
- <androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/cl_ad_root_1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
- <androidx.appcompat.widget.AppCompatImageView
- android:id="@+id/iv_ad_icon_1"
- android:layout_width="50dp"
- android:layout_height="50dp"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- tools:src="@tools:sample/avatars" />
- <androidx.appcompat.widget.AppCompatTextView
- android:id="@+id/tv_ad_title_1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
- android:textColor="@color/black"
- android:textSize="16sp"
- app:layout_constraintStart_toEndOf="@id/iv_ad_icon_1"
- app:layout_constraintTop_toTopOf="@id/iv_ad_icon_1"
- tools:text="Ad Title" />
- <androidx.appcompat.widget.AppCompatTextView
- android:id="@+id/tv_ad_title_desc_1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:layout_constraintStart_toStartOf="@id/tv_ad_title_1"
- app:layout_constraintTop_toBottomOf="@id/tv_ad_title_1"
- tools:text="Desc" />
- <FrameLayout
- android:id="@+id/fl_ad_media_content_1"
- android:layout_width="match_parent"
- android:layout_height="200dp"
- app:layout_constraintEnd_toEndOf="parent"
- android:layout_marginTop="8dp"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@id/iv_ad_icon_1"
- tools:background="@tools:sample/backgrounds/scenic"
- />
- <androidx.appcompat.widget.AppCompatButton
- android:id="@+id/btn_call_to_action_1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="4dp"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@id/fl_ad_media_content_1" />
- </androidx.constraintlayout.widget.ConstraintLayout>
- </com.composition.android.lib.ad.widget.NativeAdView>
- </LinearLayout>
- </ScrollView>
|