分割线等距修正:大时间autoSize自动缩号(40..130sp)修复6位数倒计时溢出越线,贴线对齐间隙恒24dp(v2.5)
This commit is contained in:
@@ -539,6 +539,6 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val VERSION = "2.4"
|
||||
const val VERSION = "2.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,13 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- 左:倒计时 + 任务名(右对齐贴线:右缘距分割线固定 24dp,
|
||||
与右栏对称,保证线到两边时间的布局间隙恒相等,
|
||||
不依赖两侧文字宽度恰好相同——鸿蒙系统字体数字非等宽时也成立) -->
|
||||
与右栏对称,保证线到两边时间的布局间隙恒相等)
|
||||
v2.5:倒计时 ≥100 分钟时是 6 位数(如 120:00),130sp 下宽约 410dp,
|
||||
超出半屏可用宽度,wrap_content 会被压缩且文字从框左缘起画、越过分割线
|
||||
——v2.4「装不下/越过线」的根因。改为 match_parent 定宽 + autoSize
|
||||
自动缩号(上限仍 130sp):5 位数保持 130sp 原样,6 位数缩到刚好装下,
|
||||
永不溢出。时间列结构「时间+10dp+小字」整体居中,时间中心=列中心
|
||||
-(10+小字)/2,与字号无关 → 一侧缩号不破坏竖向对齐。 -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -46,13 +51,16 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLockCountdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="40sp"
|
||||
android:autoSizeMaxTextSize="130sp"
|
||||
android:fontFeatureSettings="tnum"
|
||||
android:gravity="center_vertical|end"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="130sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
@@ -113,8 +121,9 @@
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 右:时钟(大)+ 日期星期在时钟下面(左对齐贴线:左缘距分割线固定 24dp,
|
||||
与左栏对称;tnum 强制等宽数字,系统字体支持时两侧宽度恒等、不再抖动) -->
|
||||
<!-- 右:时钟(大)+ 日期星期在时钟下面(左对齐贴线:左缘距分割线固定 24dp;
|
||||
与左栏同样 match_parent 定宽 + autoSize,字体缩放变大或位数变多时
|
||||
自动缩号,永不溢出屏幕) -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -124,13 +133,16 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLockClock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="40sp"
|
||||
android:autoSizeMaxTextSize="130sp"
|
||||
android:fontFeatureSettings="tnum"
|
||||
android:gravity="center_vertical|start"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="130sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
|
||||
Reference in New Issue
Block a user