优化界面显示

This commit is contained in:
HapeLee
2025-10-18 01:29:23 +08:00
parent 82b4a30059
commit c673169456
8 changed files with 9 additions and 51 deletions
@@ -188,55 +188,6 @@ class TitleBar @JvmOverloads constructor(
toolbar.setSubtitle(subtitleId)
}
// fun setTitleTextColor(@ColorInt color: Int) {
// toolbar.setTitleTextColor(color)
// }
//
// fun setTitleTextAppearance(@StyleRes resId: Int) {
// toolbar.setTitleTextAppearance(context, resId)
// }
//
// fun setSubTitleTextColor(@ColorInt color: Int) {
// toolbar.setSubtitleTextColor(color)
// }
//
// fun setSubTitleTextAppearance(@StyleRes resId: Int) {
// toolbar.setSubtitleTextAppearance(context, resId)
// }
//
// fun setTextColor(@ColorInt color: Int) {
// setTitleTextColor(color)
// setSubTitleTextColor(color)
// }
//
// fun setColorFilter(@ColorInt color: Int) {
// val colorFilter = PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP)
// toolbar.children.firstOrNull { it is ImageView }?.background?.colorFilter = colorFilter
// toolbar.navigationIcon?.colorFilter = colorFilter
// toolbar.overflowIcon?.colorFilter = colorFilter
// toolbar.menu.children.forEach {
// it.icon?.colorFilter = colorFilter
// }
// }
//
// override fun setBackgroundColor(color: Int) {
// if (color.alpha < 255) {
// //这里不能改为0f,改为0f在横屏模式下文字和图标颜色会变
// elevation = 0.1f
// }
// super.setBackgroundColor(color)
// }
//
// override fun setBackground(background: Drawable?) {
// if (background is ColorDrawable) {
// if (background.alpha < 255) {
// //这里不能改为0f,改为0f在横屏模式下文字和图标颜色会变
// elevation = 0.1f
// }
// }
// super.setBackground(background)
// }
fun onMultiWindowModeChanged(isInMultiWindowMode: Boolean, fullScreen: Boolean) {
// if (fitStatusBar) {
// val topPadding = if (!isInMultiWindowMode && fullScreen) context.statusBarHeight else 0
@@ -24,6 +24,8 @@
app:titleCollapseMode="scale">
<com.google.android.material.appbar.MaterialToolbar
android:theme="@style/ThemeOverlay.Material3.Toolbar.CircleNavigationButton"
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
@@ -21,6 +21,7 @@
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.google.android.material.appbar.MaterialToolbar
android:theme="@style/ThemeOverlay.Material3.Toolbar.CircleNavigationButton"
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
@@ -33,7 +33,7 @@
android:id="@+id/refresh_progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:visibility="invisible"
app:waveAmplitude="2dp"
app:waveSpeed="50dp"
app:wavelength="40dp" />
@@ -14,6 +14,7 @@
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.appbar.MaterialToolbar
android:theme="@style/ThemeOverlay.Material3.Toolbar.CircleNavigationButton"
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
@@ -24,6 +24,7 @@
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.google.android.material.appbar.MaterialToolbar
android:theme="@style/ThemeOverlay.Material3.Toolbar.CircleNavigationButton"
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
@@ -26,6 +26,7 @@
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.google.android.material.appbar.MaterialToolbar
android:theme="@style/ThemeOverlay.Material3.Toolbar.CircleNavigationButton"
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
+2 -1
View File
@@ -3,4 +3,5 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.Material3.Toolbar.CircleNavigationButton"/>