Skip to content

Commit fa65261

Browse files
Add bottom app bar native ad layout
1 parent f2c823b commit fa65261

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

app/src/main/res/layout/activity_main.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
android:id="@+id/ad_view"
5858
android:layout_width="match_parent"
5959
android:layout_height="match_parent"
60-
app:nativeAdLayout="@layout/large_home_banner_native_ad" />
60+
app:nativeAdLayout="@layout/bottom_app_bar_native_ad" />
6161
</FrameLayout>
6262

6363
<com.google.android.material.bottomnavigation.BottomNavigationView
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<com.google.android.gms.ads.nativead.NativeAdView xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
android:layout_width="match_parent"
5+
android:layout_height="wrap_content">
6+
7+
<com.google.android.material.card.MaterialCardView
8+
android:id="@+id/ad_card"
9+
style="@style/Widget.Material3.CardView.Outlined"
10+
android:layout_width="match_parent"
11+
android:layout_height="wrap_content"
12+
android:layout_marginHorizontal="16dp"
13+
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.CardViewTopRounded">
14+
15+
<include
16+
layout="@layout/ad_attribution"
17+
android:layout_gravity="top|start"
18+
android:layout_margin="8dp" />
19+
20+
<LinearLayout
21+
android:layout_width="match_parent"
22+
android:layout_height="wrap_content"
23+
android:orientation="horizontal"
24+
android:gravity="center_vertical"
25+
android:paddingStart="16dp"
26+
android:paddingEnd="16dp"
27+
android:paddingTop="24dp"
28+
android:paddingBottom="8dp">
29+
30+
<ImageView
31+
android:id="@+id/ad_app_icon"
32+
android:layout_width="32dp"
33+
android:layout_height="32dp"
34+
android:layout_marginEnd="12dp" />
35+
36+
<LinearLayout
37+
android:layout_width="0dp"
38+
android:layout_height="wrap_content"
39+
android:layout_weight="1"
40+
android:orientation="vertical">
41+
42+
<TextView
43+
android:id="@+id/ad_headline"
44+
android:layout_width="wrap_content"
45+
android:layout_height="wrap_content"
46+
android:ellipsize="end"
47+
android:maxLines="1"
48+
android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />
49+
50+
<TextView
51+
android:id="@+id/ad_body"
52+
android:layout_width="wrap_content"
53+
android:layout_height="wrap_content"
54+
android:ellipsize="end"
55+
android:maxLines="1"
56+
android:textAppearance="@style/TextAppearance.Material3.BodySmall" />
57+
</LinearLayout>
58+
59+
<com.google.android.material.button.MaterialButton
60+
android:id="@+id/ad_call_to_action"
61+
style="@style/Widget.Material3.Button.TextButton"
62+
android:layout_width="wrap_content"
63+
android:layout_height="wrap_content"
64+
android:layout_marginStart="8dp" />
65+
</LinearLayout>
66+
</com.google.android.material.card.MaterialCardView>
67+
</com.google.android.gms.ads.nativead.NativeAdView>

0 commit comments

Comments
 (0)