googleads / googleads-mobile-android-native-templates

Apache License 2.0
116 stars 102 forks source link

The Native Ad can't click & UI error #25

Closed yilmazgokhan closed 10 months ago

yilmazgokhan commented 2 years ago

I try to use com.google.android.ads.nativetemplates.TemplateView component. Not all stars can be displayed. Also, the button is not clickable.

Could I have missed something or is there something wrong with the template?

All my code related to Native Ad is like this:

private fun nativeLoadAd() {
        val adLoader = AdLoader.Builder(this, Constants.AdIds.ID_TEST_NATIVE)
            .forNativeAd { ad: NativeAd ->
                // Show the ad.
                my_template.setNativeAd(ad)
            }
            .withAdListener(object : AdListener() {
                override fun onAdFailedToLoad(adError: LoadAdError) {
                    LogUtils.d("$this ${adError.cause}")
                }
            })
            .withNativeAdOptions(
                NativeAdOptions.Builder()
                    // Methods in the NativeAdOptions.Builder class can be
                    // used here to specify individual options settings.
                    .build()
            )
            .build()
        adLoader.loadAd(AdRequest.Builder().build())
    }
    <com.google.android.ads.nativetemplates.TemplateView
        android:id="@+id/my_template"
        android:layout_width="match_parent"
        android:layout_marginStart= "@dimen/margin_card_item_horizontal"
        android:layout_marginEnd= "@dimen/margin_card_item_horizontal"
        android:layout_marginBottom= "@dimen/margin_card_item_vertical"
        android:layout_height="wrap_content"
        app:gnt_template_type="@layout/gnt_small_template_view " />

gnt_small_template_view

1

gnt_medium_template_view

2

yu-day commented 2 years ago

I have the same problem as you, my solution is Join in RatingBar :style="?android:attr/ratingBarStyleSmall"

linversion commented 2 years ago

I have the same problem as you, my solution is Join in RatingBar :style="?android:attr/ratingBarStyleSmall"

thanks, that should help