activity_main.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. xmlns:app="http://schemas.android.com/apk/res-auto"
  4. android:layout_width="match_parent"
  5. android:layout_height="match_parent"
  6. android:fitsSystemWindows="true">
  7. <com.google.android.material.appbar.AppBarLayout
  8. android:layout_width="match_parent"
  9. android:layout_height="wrap_content"
  10. android:id="@+id/abl_main"
  11. android:background="@color/white">
  12. <!--android:theme="@style/AppTheme.AppBarOverlay"-->
  13. <!--android:minHeight="?actionBarSize"水波纹居中和gravity属性有关-->
  14. <LinearLayout
  15. android:layout_width="match_parent"
  16. android:layout_height="64dp"
  17. android:paddingStart="@dimen/margin_default"
  18. android:paddingEnd="0dp"
  19. android:orientation="horizontal"
  20. app:layout_scrollFlags="scroll|enterAlways|snap"
  21. android:paddingTop="@dimen/margin_default"
  22. android:gravity="center_vertical">
  23. <ImageView
  24. android:layout_width="@dimen/size_icon_big"
  25. android:layout_height="@dimen/size_icon_big"
  26. android:layout_gravity="center_vertical"
  27. android:scaleType="fitXY"
  28. android:src="@mipmap/logo_gray"
  29. android:tint="@color/black_theme"
  30. android:visibility="gone"/>
  31. <TextView
  32. android:id="@+id/title"
  33. android:layout_width="wrap_content"
  34. android:layout_height="wrap_content"
  35. android:text="羊毛党 · 精选"
  36. android:textStyle="bold"
  37. android:textColor="@color/black_theme"
  38. android:textSize="@dimen/size_hello" />
  39. <Space
  40. android:layout_width="0dp"
  41. android:layout_height="wrap_content"
  42. android:layout_weight="1"/>
  43. <!--上方搜索-->
  44. <FrameLayout
  45. android:layout_width="wrap_content"
  46. android:layout_height="wrap_content">
  47. <RelativeLayout
  48. android:id="@+id/rl_search_top"
  49. android:layout_width="@dimen/height_edit_text"
  50. android:layout_height="@dimen/height_sliding_tab"
  51. android:background="?attr/selectableItemBackgroundBorderless">
  52. <!--无边界波纹-->
  53. <ImageView
  54. android:layout_width="wrap_content"
  55. android:layout_height="wrap_content"
  56. android:layout_centerInParent="true"
  57. android:src="@drawable/ic_search"
  58. android:tint="@color/black_theme" />
  59. </RelativeLayout>
  60. <!--由于作为ViewOverlay的View不再触发点击事件,就用一个影子View来代替-->
  61. <RelativeLayout
  62. android:id="@+id/rl_search_top_shadow"
  63. android:layout_width="@dimen/height_edit_text"
  64. android:layout_height="@dimen/height_sliding_tab">
  65. <!--无边界波纹-->
  66. <FrameLayout
  67. android:id="@+id/fl_search_top"
  68. android:layout_width="wrap_content"
  69. android:layout_height="wrap_content"
  70. android:layout_centerInParent="true"
  71. android:padding="@dimen/margin_ss"
  72. android:background="?attr/selectableItemBackgroundBorderless">
  73. <ImageView
  74. android:layout_width="wrap_content"
  75. android:layout_height="wrap_content"
  76. android:src="@drawable/ic_search"
  77. android:tint="@color/black_theme"/>
  78. </FrameLayout>
  79. </RelativeLayout>
  80. </FrameLayout>
  81. <!--更多-->
  82. <RelativeLayout
  83. android:layout_width="@dimen/height_edit_text"
  84. android:layout_height="@dimen/height_sliding_tab">
  85. <FrameLayout
  86. android:id="@+id/fl_more"
  87. android:layout_width="wrap_content"
  88. android:layout_height="wrap_content"
  89. android:layout_centerInParent="true"
  90. android:padding="@dimen/margin_ss"
  91. android:background="?attr/selectableItemBackgroundBorderless">
  92. <ImageView
  93. android:layout_width="wrap_content"
  94. android:layout_height="wrap_content"
  95. android:src="@drawable/ic_more_vert"
  96. android:tint="@color/black_theme"/>
  97. </FrameLayout>
  98. </RelativeLayout>
  99. </LinearLayout>
  100. <LinearLayout
  101. android:layout_width="match_parent"
  102. android:layout_height="wrap_content"
  103. android:orientation="horizontal"
  104. android:gravity="center_vertical"
  105. android:background="@color/white">
  106. <com.flyco.tablayout.SlidingTabLayout
  107. android:id="@+id/stl_home"
  108. android:layout_width="0dp"
  109. android:layout_weight="1"
  110. android:layout_height="@dimen/height_sliding_tab"
  111. android:layout_gravity="center_horizontal"
  112. app:tl_iconVisible="false"
  113. app:tl_indicator_bounce_enable="false"
  114. app:tl_indicator_color="@color/black_theme"
  115. app:tl_indicator_height="2.5dp"
  116. app:tl_indicator_width="10dp"
  117. app:tl_tab_width="44dp"
  118. app:tl_textBold="NONE"
  119. app:tl_textSelectColor="@color/black"
  120. app:tl_textUnselectColor="@color/colorTextSecondary"
  121. app:tl_textsize="@dimen/size_title_s"
  122. app:tl_indicator_margin_bottom="@dimen/margin_s"
  123. android:layout_marginStart="@dimen/margin_s"
  124. android:layout_marginEnd="@dimen/margin_default"/>
  125. <!--搜索-->
  126. <RelativeLayout
  127. android:id="@+id/rl_search"
  128. android:layout_width="@dimen/height_edit_text"
  129. android:layout_height="@dimen/height_sliding_tab"
  130. android:visibility="invisible">
  131. <FrameLayout
  132. android:id="@+id/fl_search"
  133. android:layout_width="wrap_content"
  134. android:layout_height="wrap_content"
  135. android:layout_centerInParent="true"
  136. android:padding="@dimen/margin_ss"
  137. android:background="?attr/selectableItemBackgroundBorderless">
  138. <ImageView
  139. android:layout_width="wrap_content"
  140. android:layout_height="wrap_content"
  141. android:src="@drawable/ic_search"
  142. android:tint="@color/black_theme"/>
  143. </FrameLayout>
  144. <!--无边界波纹-->
  145. </RelativeLayout>
  146. </LinearLayout>
  147. </com.google.android.material.appbar.AppBarLayout>
  148. <androidx.viewpager.widget.ViewPager
  149. android:id="@+id/vp_main"
  150. android:layout_width="match_parent"
  151. android:layout_height="match_parent"
  152. app:layout_behavior="@string/appbar_scrolling_view_behavior" />
  153. </androidx.coordinatorlayout.widget.CoordinatorLayout>