瀏覽代碼

Rounded bottom sheets

arkon 4 年之前
父節點
當前提交
6662e2002f

+ 3 - 2
app/src/main/res/layout/common_tabbed_sheet.xml

@@ -8,14 +8,15 @@
 
     <androidx.constraintlayout.widget.ConstraintLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:background="?attr/colorPrimary">
+        android:layout_height="wrap_content">
 
+        <!-- Remove background color so rounded sheet corners work -->
         <com.google.android.material.tabs.TabLayout
             android:id="@+id/tabs"
             style="@style/Theme.Widget.Tabs"
             android:layout_width="0dp"
             android:layout_height="wrap_content"
+            android:background="@android:color/transparent"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toStartOf="@+id/menu"
             app:layout_constraintStart_toStartOf="parent"

+ 13 - 0
app/src/main/res/values/styles.xml

@@ -56,6 +56,19 @@
         <item name="android:windowIsFloating">false</item>
         <item name="android:statusBarColor">@android:color/transparent</item>
         <item name="android:navigationBarColor">?attr/colorPrimary</item>
+        <item name="bottomSheetStyle">@style/Theme.BottomSheet.Style</item>
+    </style>
+
+    <style name="Theme.BottomSheet.Style" parent="Widget.MaterialComponents.BottomSheet">
+        <item name="shapeAppearanceOverlay">@style/Theme.BottomSheet.Style.ShapeAppearance</item>
+    </style>
+
+    <style name="Theme.BottomSheet.Style.ShapeAppearance" parent="">
+        <item name="cornerFamily">rounded</item>
+        <item name="cornerSizeTopRight">8dp</item>
+        <item name="cornerSizeTopLeft">8dp</item>
+        <item name="cornerSizeBottomRight">0dp</item>
+        <item name="cornerSizeBottomLeft">0dp</item>
     </style>
 
 

+ 2 - 0
app/src/main/res/values/themes.xml

@@ -218,6 +218,7 @@
         <item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.Dark.ActionBar</item>
         <item name="actionBarPopupTheme">@style/ThemeOverlay.MaterialComponents</item>
         <item name="switchStyle">@style/Theme.Widget.BasicSwitch</item>
+        <item name="bottomSheetDialogTheme">@style/Theme.BottomSheet</item>
     </style>
 
     <style name="Theme.Base.Reader.Light" parent="Theme.Base">
@@ -233,6 +234,7 @@
         <item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.Dark.ActionBar</item>
         <item name="actionBarPopupTheme">@style/ThemeOverlay.MaterialComponents</item>
         <item name="switchStyle">@style/Theme.Widget.BasicSwitch</item>
+        <item name="bottomSheetDialogTheme">@style/Theme.BottomSheet</item>
     </style>
 
     <style name="Theme.Reader.Dark" parent="Theme.Base.Reader.Dark" />