activity_ad_banner.xml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. xmlns:app="http://schemas.android.com/apk/res-auto"
  4. xmlns:tools="http://schemas.android.com/tools"
  5. android:layout_width="match_parent"
  6. android:orientation="vertical"
  7. android:layout_height="match_parent">
  8. <androidx.appcompat.widget.AppCompatButton
  9. android:id="@+id/btn_load_banner"
  10. android:layout_width="match_parent"
  11. android:layout_height="wrap_content"
  12. android:text="加载广告"
  13. app:layout_constraintTop_toTopOf="parent"
  14. app:layout_constraintStart_toStartOf="parent"
  15. app:layout_constraintEnd_toEndOf="parent"/>
  16. <androidx.appcompat.widget.AppCompatButton
  17. android:id="@+id/btn_show_banner"
  18. android:layout_width="match_parent"
  19. android:layout_height="wrap_content"
  20. android:text="显示广告"
  21. app:layout_constraintTop_toTopOf="parent"
  22. app:layout_constraintStart_toStartOf="parent"
  23. app:layout_constraintEnd_toEndOf="parent"/>
  24. <androidx.appcompat.widget.AppCompatButton
  25. android:id="@+id/btn_load_and_show"
  26. android:layout_width="match_parent"
  27. android:layout_height="wrap_content"
  28. android:text="加载并显示广告"
  29. app:layout_constraintTop_toTopOf="parent"
  30. app:layout_constraintStart_toStartOf="parent"
  31. app:layout_constraintEnd_toEndOf="parent"/>
  32. <LinearLayout
  33. android:id="@+id/ll_ad_content"
  34. android:layout_width="match_parent"
  35. android:layout_height="wrap_content"
  36. android:orientation="vertical"
  37. />
  38. <androidx.appcompat.widget.AppCompatTextView
  39. android:layout_width="wrap_content"
  40. android:layout_height="wrap_content"
  41. android:layout_marginTop="8dp"
  42. android:text="以下为自动加载广告View,先配置好AdUnitBean,这里只需要指定ad_slot_name(广告位名称)即可"
  43. />
  44. <com.composition.android.lib.ad.widget.BannerAdView
  45. android:layout_width="wrap_content"
  46. android:layout_height="wrap_content"
  47. app:ad_slot_name="banner"
  48. />
  49. </LinearLayout>