android l launcher,AndroidL中修改launcher3主菜單布局

Android4.4之后的Launcher3,主菜單布局的行數和列數,都是在DynamicGrid.java中動態計算的,xml中無法配置。

如果想修改主菜單的布局,調整行數和列數,需要修改DynamicGrid.java中對應的值.

DynamicGrid.java中allAppsNumRows和allAppsNumCols的值.allAppsNumRows = (availableHeightPx - pageIndicatorOffset - 4 * edgeMarginPx) /(iconSizePx + iconTextSizePx + 2 * edgeMarginPx);allAppsNumCols = (availableWidthPx - padding.left - padding.right - 2 * edgeMarginPx) /(iconSizePx + 2 * edgeMarginPx);

源碼中:

DeviceProfile(String n, float w, float h, float r, float c,

float is, float its, float hs, float his) {

// Ensure that we have an odd number of hotseat items (since we need to place all apps)

if (!AppsCustomizePagedView.DISABLE_ALL_APPS && hs % 2 == 0) {

throw new RuntimeException("All Device Profiles must have an odd number of hotseat spaces");

}

name = n;

minWidthDps = w;

minHeightDps = h;

numRows = r;

numColumns = c;

iconSize = is;

iconTextSize = its;

numHotseatIcons = hs;

hotseatIconSize = his;

}

從網絡處獲得。對應的數據均為默認值http://www.bubuko.com/infodetail-541421.html

 DeviceProfile(String n, float w, float h, float r, float c,

float is, float its, float hs, float his) {

// Ensure that we have an odd number of hotseat items (since we need to place all apps)

if (!LauncherAppState.isDisableAllApps() && hs % 2 == 0) {

throw new RuntimeException("All Device Profiles must have an odd number of hotseat spaces");

}

//Log.v("zxxl",">>n="+n+">>>>w="+w+">>>>>h="+h+">>>>r="+r+">>>>c="+c+">>>>is="+is+">>>its="+its+">>>hs="+hs+">>>his="+his);

name = n;

minWidthDps = 1200;

minHeightDps = 1920;

numRows = 5;

numColumns = 6;

iconSize = 68;

iconTextSize = 14.4f;

numHotseatIcons = 7;

hotseatIconSize = 72;

}

我們在android 4.4之前,launcher里設置默認桌面布局,一般都是更改的default_workspace.xml這個文件,

但是在android4.4.4后,launcher3上,卻好像是用了數據庫來代替了布局文件 ,

現在無論如何修改哪個目錄下的default_workspace.xml,都不會起任何作用,求大神們指點下,

如果要改用default_workspace.xml來配置桌面布局,該如何做?

android4.4.4也是通過default_workspace.xml來修改的.文件

LauncherProvider.java里的loadDefaultFavoritesIfNecessary() 方法

這中的if (sp.getBoolean(EMPTY_DATABASE_CREATED, false)) { 注釋掉即可.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值