网站目录结构怎么做,网站域名怎么写好,哪里有网站开发公司,开一个建筑公司容易吗1.概述 在12.0 产品定制化开发中 由产品需求Launcher3 页面布局的原因#xff0c;要求Launcher3 需要去掉Hotseat 不显示Hotseat下面几个图标#xff0c;而做满屏app的显示#xff0c;从而达到美观的效果#xff0c;下面就来分析去掉Hotseat从而实现这个功能
2.Launcher3 …1.概述 在12.0 产品定制化开发中 由产品需求Launcher3 页面布局的原因要求Launcher3 需要去掉Hotseat 不显示Hotseat下面几个图标而做满屏app的显示从而达到美观的效果下面就来分析去掉Hotseat从而实现这个功能
2.Launcher3 去掉Hotseat的核心类
packages/apps/Launcher3/res/layout/launcher.xml
packages/apps/Launcher3/src/com/android/launcher3/DeviceProfile.java3.Launcher3 去掉Hotseat的核心功能分析和实现 在Launcher3中主页面就是launcher.xml只布局hotseat布局也在这里面所以隐藏hotseat可以从这里先看launcher.xml的布局。 首先看下launcher.xml的布局
3.1 launcher.xml hotseat布局
com.android.launcher3.LauncherRootView
xmlns:androidhttp://schemas.android.com/apk/res/android
xmlns:launcherhttp://schemas.android.com/apk/res-auto
android:idid/launcher
android:layout_widthmatch_parent
android:layout_heightmatch_parent
android:fitsSystemWindowstrue
com.android.launcher3.dragndrop.DragLayerandroid:idid/drag_layerandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:clipChildrenfalseandroid:clipToPaddingfalseandroid:importantForAccessibilityno!-- The workspace contains 5 screens of cells --!-- DO NOT CHANGE THE ID --com.android.launcher3.Workspaceandroid:idid/workspaceandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:layout_gravitycenterandroid:themestyle/HomeScreenElementThemelauncher:pageIndicatorid/page_indicator /include layoutlayout/memoryinfo_ext /!-- DO NOT CHANGE THE ID --includeandroid:idid/hotseatlayoutlayout/hotseat /includeandroid:idid/overview_panellayoutlayout/overview_panelandroid:visibilitygone /!-- Keep these behind the workspace so that they are not visible whenwe go into AllApps --com.sprd.ext.pageindicators.WorkspacePageIndicatorLineandroid:idid/page_indicatorandroid:layout_widthmatch_parentandroid:layout_heightdimen/vertical_drag_handle_sizeandroid:layout_gravitybottomandroid:themestyle/HomeScreenElementTheme /includeandroid:idid/page_indicator_customizelayoutlayout/page_indicator_customize /includeandroid:idid/drop_target_barlayoutlayout/drop_target_bar /includeandroid:idid/scrim_viewlayoutlayout/scrim_view /includeandroid:idid/apps_viewlayoutlayout/all_appsandroid:layout_widthmatch_parentandroid:layout_heightmatch_parent //com.android.launcher3.dragndrop.DragLayer/com.android.launcher3.LauncherRootView从布局中可以看到android:idid/hotseat就是hotseat布局所以隐藏hotseat就是需要设置属性为gone。
includeandroid:idid/hotseatlayoutlayout/hotseatandroid:visibilitygone /3.2 DeviceProfile.java 关于hotseat高度的修改
public DeviceProfile(Context context, InvariantDeviceProfile inv,
Point minSize, Point maxSize,
int width, int height, boolean isLandscape, boolean isMultiWindowMode) {this.inv inv;this.isLandscape isLandscape;this.isMultiWindowMode isMultiWindowMode;// Determine sizes.widthPx width;heightPx height;if (isLandscape) {availableWidthPx maxSize.x;availableHeightPx minSize.y;} else {availableWidthPx minSize.x;availableHeightPx maxSize.y;}Resources res context.getResources();DisplayMetrics dm res.getDisplayMetrics();// Constants from resourcesisTablet res.getBoolean(R.bool.is_tablet);isLargeTablet res.getBoolean(R.bool.is_large_tablet);isPhone !isTablet !isLargeTablet;aspectRatio ((float) Math.max(widthPx, heightPx)) / Math.min(widthPx, heightPx);boolean isTallDevice Float.compare(aspectRatio, TALL_DEVICE_ASPECT_RATIO_THRESHOLD) 0;// Some more constantstransposeLayoutWithOrientation res.getBoolean(R.bool.hotseat_transpose_layout_with_orientation);context getContext(context, isVerticalBarLayout()? Configuration.ORIENTATION_LANDSCAPE: Configuration.ORIENTATION_PORTRAIT);res context.getResources();edgeMarginPx res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);desiredWorkspaceLeftRightMarginPx isVerticalBarLayout() ? 0 : edgeMarginPx;int cellLayoutPaddingLeftRightMultiplier !isVerticalBarLayout() isTablet? PORTRAIT_TABLET_LEFT_RIGHT_PADDING_MULTIPLIER : 1;int cellLayoutPadding res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_layout_padding);if (isLandscape) {cellLayoutPaddingLeftRightPx 0;cellLayoutBottomPaddingPx cellLayoutPadding;} else {cellLayoutPaddingLeftRightPx cellLayoutPaddingLeftRightMultiplier * cellLayoutPadding;cellLayoutBottomPaddingPx 0;}verticalDragHandleSizePx res.getDimensionPixelSize(R.dimen.vertical_drag_handle_size);verticalDragHandleOverlapWorkspace res.getDimensionPixelSize(R.dimen.vertical_drag_handle_overlap_workspace);IconLabelController ilc LauncherAppMonitor.getInstance(context).getIconLabelController();maxIconLabelLines ilc ! null ?ilc.getIconLabelLine() : IconLabelController.MIN_ICON_LABEL_LINE;iconDrawablePaddingOriginalPx res.getDimensionPixelSize(R.dimen.dynamic_grid_icon_drawable_padding);dropTargetBarSizePx res.getDimensionPixelSize(R.dimen.dynamic_grid_drop_target_size);workspaceSpringLoadedBottomSpace res.getDimensionPixelSize(R.dimen.dynamic_grid_min_spring_loaded_space);workspaceCellPaddingXPx res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_padding_x);hotseatBarTopPaddingPx res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_top_padding);hotseatBarBottomPaddingPx (isTallDevice ? 0: res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_non_tall_padding)) res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_padding);hotseatBarSidePaddingEndPx res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_side_padding);// Add a bit of space between nav bar and hotseat in vertical bar layout.hotseatBarSidePaddingStartPx isVerticalBarLayout() ? verticalDragHandleSizePx : 0;hotseatBarSizePx ResourceUtils.pxFromDp(inv.iconSize, dm) (isVerticalBarLayout()? (hotseatBarSidePaddingStartPx hotseatBarSidePaddingEndPx): (res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size) hotseatBarTopPaddingPx hotseatBarBottomPaddingPx));....}在DeviceProile构造函数中的hotseatBarSizePx 就是设置的导航栏高度在这里构建hotseat布局的时候可以通过设置这个高度了布后hotseatBarSizePx就是hotseat的高度 直接设为0即可 修改如下:
hotseatBarSizePx 0/*ResourceUtils.pxFromDp(inv.iconSize, dm) (isVerticalBarLayout()? (hotseatBarSidePaddingStartPx hotseatBarSidePaddingEndPx): (res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size) hotseatBarTopPaddingPx hotseatBarBottomPaddingPx))*/;