Skip to content

Commit b0685e6

Browse files
committed
update style of tabs
1 parent ab7493c commit b0685e6

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

entry/src/main/ets/entryability/EntryAbility.ets

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit';
22
import { hilog } from '@kit.PerformanceAnalysisKit';
3-
import { window } from '@kit.ArkUI';
3+
import { display, window } from '@kit.ArkUI';
44
import { abilityAccessCtrl, bundleManager, Permissions } from '@kit.AbilityKit';
5+
import { BusinessError } from '@kit.BasicServicesKit';
6+
import { STYLE_CONFIGURATION } from '../model/TabStyle';
57

68
const DOMAIN = 0x0000;
79

@@ -27,11 +29,24 @@ export default class EntryAbility extends UIAbility {
2729
hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.');
2830
});
2931

32+
windowStage.getMainWindow((err: BusinessError, window: window.Window) => {
33+
if (err.code) {
34+
hilog.error(0x0000, 'testTag', 'Failed to get the main window. Cause: %{public}s', JSON.stringify(err) ?? '');
35+
return;
36+
}
37+
window.setWindowDecorVisible(false);
38+
window.setWindowDecorHeight(STYLE_CONFIGURATION.TAB_BAR_HEIGHT);
39+
});
40+
3041
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
3142
await atManager.requestPermissionsFromUser(this.context, ['ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY']);
3243
await atManager.requestPermissionsFromUser(this.context, ['ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY']);
3344
}
3445

46+
px2vp(px: number) {
47+
return px / display.getDefaultDisplaySync().densityPixels;
48+
}
49+
3550
onWindowStageDestroy(): void {
3651
// Main window is destroyed, release UI related resources
3752
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');

entry/src/main/ets/pages/TabSheets.ets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export struct TabSheets {
7878
}
7979
.padding({
8080
left: STYLE_CONFIGURATION.TAB_SHEET_PADDING,
81-
right: STYLE_CONFIGURATION.TAB_SHEET_PADDING,
81+
right: STYLE_CONFIGURATION.TAB_SHEET_PADDING + 150,
8282
top: STYLE_CONFIGURATION.TAB_SHEET_PADDING
8383
})
8484
.backgroundColor('#333333')

0 commit comments

Comments
 (0)