activity_ad_banner.xml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. <View
  39. android:layout_width="match_parent"
  40. android:layout_height="20dp"
  41. android:background="@color/app_line_color"
  42. />
  43. <androidx.appcompat.widget.AppCompatTextView
  44. android:layout_width="wrap_content"
  45. android:layout_height="wrap_content"
  46. android:layout_marginTop="8dp"
  47. android:text="以下为自动加载广告View,先配置好AdUnitBean,这里只需要指定ad_slot_name(广告位名称)即可\n
  48. com.composition.android.lib.ad.widget.BannerAdView"
  49. />
  50. <com.composition.android.lib.ad.widget.BannerAdView
  51. android:layout_width="match_parent"
  52. android:layout_height="wrap_content"
  53. app:ad_slot_name="banner"
  54. />
  55. </LinearLayout>