...
Using a RecyclerView
Info |
---|
We need you to edit your item Layout, so it has a wrapper/holder for the Ads. |
...
, this size changes in the layout will be limited by the ad configurations that |
...
your technical account manager can edit. |
Get the RecyclerView
Code Block | ||
---|---|---|
| ||
// Find your view, this is the simplest but there are better ways val rv = findViewById<RecyclerView>(R.id.infiniteScroll_recyclerView_manual) //Create and use your own adapter rv.adapter = <add your adapter> //Linear layour is the most common but feel free to swap it rv.layoutManager = LinearLayoutManager(this) |
Prepare the Item View
Normal item Code would look something like
...
Code Block |
---|
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout 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:layout_marginStart="10dp" android:layout_marginEnd="10dp"> <Button android:id="@+id/infinitescroll_item_button_auto" android:layout_width="0dp" android:layout_height="wrap_content" android:text="Button" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.0" /> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:tag="infiniteScroll_ad_wrapper_tag" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/infinitescroll_item_button_auto" app:layout_constraintVertical_bias="0.0"> </FrameLayout> </androidx.constraintlayout.widget.ConstraintLayout> |
Show the
...
Ads
In the example we are using a Test Id.
If you are not testing the app, change it for the proper ID that you got from us.
...
Code Block | ||||
---|---|---|---|---|
| ||||
# MainActivity.kt val infiniteScrollConfigId = ConfigBuilder.BANNERINFINITE_SCROLL_TEST_R89_CONFIG_ID val infiniteScrollLifecycleListener = <create the listener with a method or inplace> RefineryAdFactory.createInfiniteScroll(infiniteScrollConfigId, rv, infiniteScrollLifecycleListener) |
...