[RK3588 Android12]系统桌面添加时钟日期部件

查看packages/apps/Launcher3/res/xml/device_profiles.xml
launcher:deviceCategory为平板的配置项使用的布局文件为default_workspace_6x5.xml

    <grid-option
        launcher:name="6_by_5"
        launcher:numRows="5"
        launcher:numColumns="6"
        launcher:numFolderRows="3"
        launcher:numFolderColumns="3"
        launcher:numHotseatIcons="6"
        launcher:numAllAppsColumns="6"
        launcher:dbFile="launcher_6_by_5.db"
        launcher:defaultLayoutId="@xml/default_workspace_6x5"
        launcher:deviceCategory="tablet" >

修改packages/apps/Launcher3/res/xml/default_workspace_6x5.xml
添加时钟部件

diff --git a/packages/apps/Launcher3/res/xml/default_workspace_6x5.xml b/packages/apps/Launcher3/res/xml/default_workspace_6x5.xml
index b078cfd7f8..7b3d02a228 100644
--- a/packages/apps/Launcher3/res/xml/default_workspace_6x5.xml
+++ b/packages/apps/Launcher3/res/xml/default_workspace_6x5.xml
@@ -72,5 +72,14 @@
         <favorite launcher:uri="#Intent;action=android.media.action.STILL_IMAGE_CAMERA;end" />
         <favorite launcher:uri="#Intent;action=android.intent.action.CAMERA_BUTTON;end" />
     </resolve>
+    
+    <appwidget
+        launcher:screen="0"
+        launcher:x="1"
+        launcher:y="2"
+        launcher:spanX="4"
+        launcher:spanY="2"      
+        launcher:className="com.android.alarmclock.DigitalAppWidgetProvider"
+        launcher:packageName="com.android.deskclock"/>
 
 </favorites>

时钟24小时制显示
修改packages/apps/DeskClock/res/layout/digital_widget.xml将
android:format12Hour=“@string/lock_screen_12_hour_format”
改为
android:format12Hour=“@string/lock_screen_24_hour_format”

diff --git a/packages/apps/DeskClock/res/layout/digital_widget.xml b/packages/apps/DeskClock/res/layout/digital_widget.xml
index c5b4837a6f..c2d1d48183 100644
--- a/packages/apps/DeskClock/res/layout/digital_widget.xml
+++ b/packages/apps/DeskClock/res/layout/digital_widget.xml
@@ -29,7 +29,7 @@
         android:layout_height="wrap_content"
         android:layout_gravity="center_horizontal|top"
         android:ellipsize="none"
-        android:format12Hour="@string/lock_screen_12_hour_format"
+        android:format12Hour="@string/lock_screen_24_hour_format"
         android:format24Hour="@string/lock_screen_24_hour_format"
         android:includeFontPadding="false"
         android:singleLine="true"

猜你喜欢

转载自blog.csdn.net/zsq122021821/article/details/128396511