Admob Native advanced (Example)

All Admob Example : https://github.com/googleads/googleads-mobile-android-examples

Admob Official Doc: https://developers.google.com/admob/android/native/

Github Link: https://github.com/googleads/googleads-mobile-android-examples/tree/master/java/admob/NativeAdvancedExample/

 

you tube video: https://youtu.be/wENWbEKRfaM

 

FEED LAYOUT ADD========================================

<?xml version="1.0" encoding="utf-8"?>
<com.google.android.gms.ads.formats.UnifiedNativeAdView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    >

    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="@drawable/bg_white_border_no"
        app:cardBackgroundColor="@color/whiteBgcolor"
        app:cardCornerRadius="10dp"
        app:cardElevation="2dp"
        app:cardUseCompatPadding="true"
        android:minHeight="50dp">


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="10dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <ImageView
                    android:id="@+id/ad_app_icon"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:src="@drawable/logo_xml"
                    android:adjustViewBounds="true"
                    android:paddingBottom="5dp"
                    android:paddingEnd="5dp"
                    android:paddingRight="5dp"/>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:weightSum="5"
                        >
                        <TextView
                            android:layout_weight="4"
                            android:id="@+id/ad_headline"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:textColor="@color/tintColor"
                            android:textSize="15sp"
                            android:textStyle="bold"
                            android:text="Mess Manager"/>
                        <TextView
                            android:layout_weight="1"
                            style="@style/AppTheme.AdAttribution"
                            />
                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">

                        <TextView
                            android:id="@+id/ad_advertiser"
                            android:layout_width="wrap_content"
                            android:layout_height="match_parent"
                            android:gravity="bottom"
                            android:textSize="13sp"
                            android:textStyle="bold"
                            android:textColor="@color/textColorBlack"
                            android:text="Manager Your Mess More Easily"
                            />

                        <RatingBar
                            android:id="@+id/ad_stars"
                            style="?android:attr/ratingBarStyleSmall"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:isIndicator="true"
                            android:numStars="5"
                            android:stepSize="0.5" />
                    </LinearLayout>

                </LinearLayout>
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/ad_body"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="12sp"
                    android:text="Mess Manager is an android application.that will make your mess life easier."

                    />

                <com.google.android.gms.ads.formats.MediaView
                    android:id="@+id/ad_media"
                    android:layout_width="match_parent"
                    android:layout_height="200dp"
                    android:layout_gravity="center_horizontal"
                    android:layout_marginTop="5dp"
                    android:scaleType="fitXY"
                    android:visibility="gone"/>
                <TextView
                    android:id="@+id/ad_price"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:padding="5dp"
                    android:textSize="12sp"
                    android:text="500tk"/>

                <TextView
                    android:id="@+id/ad_store"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:padding="5dp"
                    android:textSize="12sp"
                    android:text="mess shop"
                    />

                <Button
                    android:id="@+id/ad_call_to_action"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:textSize="17sp"
                    android:layout_marginTop="5dp"
                    android:background="@drawable/bg_btn_primary"
                    android:text="install now"
                    />
            </LinearLayout>
        </LinearLayout>
    </androidx.cardview.widget.CardView>

</com.google.android.gms.ads.formats.UnifiedNativeAdView>

 

 

 

top