layout_item_payment_way.xml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <layout 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. <data>
  6. <variable
  7. name="paymentWayName"
  8. type="String" />
  9. <variable
  10. name="paymentWayIcon"
  11. type="android.graphics.drawable.Drawable" />
  12. <variable
  13. name="position"
  14. type="Integer" />
  15. <variable
  16. name="selectedPosition"
  17. type="androidx.lifecycle.LiveData&lt;Integer>" />
  18. </data>
  19. <androidx.constraintlayout.widget.ConstraintLayout
  20. android:layout_width="match_parent"
  21. android:layout_height="wrap_content"
  22. android:background="@drawable/bg_ripple_common_mask">
  23. <Space
  24. android:id="@+id/space1"
  25. android:layout_width="match_parent"
  26. android:layout_height="0dp"
  27. app:layout_constraintDimensionRatio="360:10"
  28. app:layout_constraintTop_toTopOf="parent" />
  29. <ImageView
  30. android:id="@+id/item_payment_icon"
  31. android:layout_width="0dp"
  32. android:layout_height="0dp"
  33. android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
  34. android:src="@{paymentWayIcon}"
  35. app:layout_constraintDimensionRatio="1:1"
  36. app:layout_constraintLeft_toLeftOf="parent"
  37. app:layout_constraintTop_toBottomOf="@+id/space1"
  38. app:layout_constraintWidth_percent="0.0666666666666667"
  39. tools:src="@drawable/icon_wechat_payment" />
  40. <Space
  41. android:id="@+id/space2"
  42. android:layout_width="match_parent"
  43. android:layout_height="0dp"
  44. app:layout_constraintDimensionRatio="360:10"
  45. app:layout_constraintTop_toBottomOf="@+id/item_payment_icon" />
  46. <TextView
  47. android:layout_width="wrap_content"
  48. android:layout_height="wrap_content"
  49. android:layout_marginStart="12dp"
  50. android:text="@{paymentWayName}"
  51. android:textColor="#202020"
  52. android:textSize="14sp"
  53. app:layout_constraintBottom_toBottomOf="@id/item_payment_icon"
  54. app:layout_constraintLeft_toRightOf="@id/item_payment_icon"
  55. app:layout_constraintTop_toTopOf="@id/item_payment_icon"
  56. tools:text="微信支付" />
  57. <ImageView
  58. android:layout_width="0dp"
  59. android:layout_height="0dp"
  60. android:layout_marginEnd="20dp"
  61. android:src="@{position == selectedPosition ? @drawable/icon_login_check_box_checked : @drawable/icon_login_check_box_unchecked}"
  62. app:layout_constraintBottom_toBottomOf="@+id/item_payment_icon"
  63. app:layout_constraintDimensionRatio="1:1"
  64. app:layout_constraintRight_toRightOf="parent"
  65. app:layout_constraintTop_toTopOf="@+id/item_payment_icon"
  66. app:layout_constraintWidth_percent="0.0555555555555556"
  67. tools:src="@drawable/icon_login_check_box_checked" />
  68. </androidx.constraintlayout.widget.ConstraintLayout>
  69. </layout>