-
Notifications
You must be signed in to change notification settings - Fork 7
/
styles.xml
99 lines (88 loc) · 6.25 KB
/
styles.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 若两个 style 之间没有空行,则两个 style 之间有关联 -->
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<!-- 设置全局alertDialog的主题 -->
<!--<item name="alertDialogTheme">@style/AlertDialog</item>-->
<!--<item name="bottomSheetDialogTheme">@style/BottomSheetBgNullTheme</item>-->
</style>
<!-- DarkActionBar主题的alertDialogTheme默认设置的是android:ThemeOverlay.Material.Dialog.Alert -->
<style name="AlertDialog" parent="android:ThemeOverlay.Material.Dialog.Alert">
<!-- 以下3个可以改变标题、按钮文字的属性 -->
<item name="android:textSize">20sp</item>
<item name="android:textColor">#ff0000</item>
<item name="android:textStyle">bold</item>
<!-- 这个可修改消息体文字的颜色 -->
<item name="android:textColorPrimary">@android:color/darker_gray</item>
<!-- 内容区背景,我用的是圆角矩形 -->
<item name="android:windowBackground">@drawable/round_rectangle</item>
<!-- 按钮上的文字的颜色,以上面的textColor为主 -->
<item name="android:colorAccent">#00FF00</item>
<!-- dialog的最小宽度占总屏幕宽度的百分比,这个必须有,否则内容区左右的空白就太小了,但是这里的值无效 -->
<item name="android:windowMinWidthMinor"/>
</style>
<style name="NoBackgroundDialog" parent="android:ThemeOverlay.Material.Dialog.Alert">
<item name="android:windowBackground">@null</item><!-- 内容区背景 -->
<!-- dialog的最小宽度占总屏幕宽度的百分比,这个必须有,否则背景太大,但是这里的值无效 -->
<item name="android:windowMinWidthMinor"/>
<!--<item name="android:background">@null</item>--><!-- 完全不要背景 -->
<!-- 这几个是android:ThemeOverlay.Material.Dialog.Alert默认的 -->
<!--<item name="android:windowIsTranslucent">true</item>--> <!-- 半透明 -->
<!--<item name="android:windowNoTitle">true</item>-->
<!-- 这几个是android:Theme.Material.Dialog.Alert默认的 -->
<!--<item name="android:backgroundDimEnabled">true</item>--><!-- 模糊,不想要AlertDialog半透明黑色背景请设置false -->
<!--<item name="android:windowFrame">@null</item>--><!-- 边框 -->
<!--<item name="android:windowContentOverlay">@null</item>--> <!-- 是否有遮盖 -->
<!--<item name="android:windowAnimationStyle">@null</item>-->
</style>
<style name="AlertDialogTheme" parent="android:ThemeOverlay.Material.Dialog.Alert">
<!--内容区背景,白色带点透明,加上毛玻璃效果,就和iOS非常接近了-->
<item name="android:windowBackground">@drawable/sh_2_btn_alert_bg</item>
<item name="android:windowBlurBehindEnabled">true</item>
<item name="android:windowBackgroundBlurRadius">20dp</item>
<item name="android:windowBlurBehindRadius">20dp</item>
</style>
<style name="BottomSheetModalBgNull" parent="Widget.Design.BottomSheet.Modal">
<item name="android:background">@null</item><!--或者自定义背景-->
</style>
<style name="BottomSheetBgNullTheme" parent="Theme.MaterialComponents.Light.BottomSheetDialog">
<!--去掉BottomSheetDialog的背景,方便自定义视图添加圆角什么的-->
<item name="bottomSheetStyle">@style/BottomSheetModalBgNull</item>
</style>
<style name="TranslucentBarTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowTranslucentStatus">true</item>
<!--<item name="android:windowTranslucentNavigation">true</item>-->
<!--Android 5.x开始需要把颜色设置透明,否则导航栏会呈现系统默认的浅灰色-->
<item name="android:statusBarColor">@android:color/transparent</item>
<!--<item name="android:statusBarColor">@android:color/white</item>-->
<!-- 底部导航栏的背景色(三个 ◀ ■ ≡ 按钮,或新版的底部导航栏) -->
<!--<item name="android:navigationBarColor">@android:color/transparent</item>-->
<!-- Android 6.0以上 状态栏字色和图标为浅黑色-->
<item name="android:windowLightStatusBar">true</item>
<!-- 某些手机设置上面3个后,status bar 还是会有半透明黑色 bar,那么把 android:windowTranslucentStatus 设置去掉,然后在activity中调用 getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN|View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) 方法即可兼容 -->
<!-- 整个主题的背景色 -->
<!--<item name="android:colorBackground">@android:color/white</item>-->
<!--<item name="android:windowDrawsSystemBarBackgrounds">true</item>-->
<!-- 这个最好放在单个布局文件中去,有时候会影响Toast的布局 -->
<!--<item name="android:fitsSystemWindows">true</item>-->
<!-- 下面两个属性设置成相同的颜色,貌似也可以实现app顶部栏和状态栏颜色一体化 -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimary</item>
</style>
<style name="LauncherTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- 整个主题的背景色 -->
<!--<item name="android:colorBackground">@android:color/white</item>-->
<!--<item name="android:windowDrawsSystemBarBackgrounds">true</item>-->
<!-- 设置启动页,这个属性只能是drawable,不能是layout,貌似API 30 以上可用layout -->
<item name="android:windowSplashscreenContent">@drawable/launcher_splash</item>
<!-- 禁用启动窗口,启动页 -->
<!--<item name="android:windowDisablePreview">true</item>-->
<!-- 这个属性在8.0之前可以当成简单的启动页 -->
<!--<item name="android:windowBackground">@drawable/launcher_splash</item>-->
</style>
</resources>