Launcher3 HotSeat显示名称
来源:互联网 发布:美国研究生费用 知乎 编辑:程序博客网 时间:2024/06/05 08:09
今天闲的无聊,研究了下launcher代码,看到Hotseat.java的时候,想起来以前有做过显示hotseat中应用名称,因为换了公司代码都没拿出来,就想在试着修改,看了很久发现无从下手,记得hotseat中默认是显示应用名称的,只是hotseat位置靠下所以名称显示不出来,只要把hotseat向上移一下就可以显示出来了,可是找了半天不知道修改那个位置,只能重新研究下hotseat的代码了。
看hotseat.java中
@Override protected void onFinishInflate() { super.onFinishInflate(); LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); mAllAppsButtonRank = grid.hotseatAllAppsRank; mContent = (CellLayout) findViewById(R.id.layout); if (grid.isLandscape && !grid.isLargeTablet()) { mContent.setGridSize(1, (int) grid.numHotseatIcons); } else { mContent.setGridSize((int) grid.numHotseatIcons, 1); } mContent.setIsHotseat(true); Log.i(TAG, "onFinishInflate,(int) grid.numHotseatIcons: " + (int) grid.numHotseatIcons); resetLayout(); }
mContent.setIsHotseat(true); 这个是判断是否是Hotseat的地方,简便的做法是直接修改为false,意思是这个这个不是HotSeat,那么作为普通快捷图标肯定是能显示名称的,但是这有一个问题那个allapp的名称还是没显示出来,暂时的做法是allAppsButton.setText(context.getString(R.string.all_apps_button_label));
这样hotseat就可以正常显示应用名称了。
在cellLayout.java中
public void setIsHotseat(boolean isHotseat) { mIsHotseat = isHotseat; mShortcutsAndWidgets.setIsHotseat(false);} public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params, boolean markCells) { final LayoutParams lp = params; // Hotseat icons - remove text if (child instanceof BubbleTextView) { BubbleTextView bubbleChild = (BubbleTextView) child; bubbleChild.setTextVisibility(!mIsHotseat); } ... }
发现 addview的时候会根据是否是HotSeat去显示和隐藏,但是只改这里会发现字体只显示了一半,继续跟踪mShortcutsAndWidgets.setIsHotseat(false);
终于明白了
public void setIsHotseat(boolean isHotseat) { mIsHotseatLayout = isHotseat; } int getCellContentWidth() { final LauncherAppState app = LauncherAppState.getInstance(); final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); return Math.min(getMeasuredHeight(), mIsHotseatLayout ? grid.hotseatCellWidthPx: grid.cellWidthPx); } int getCellContentHeight() { final LauncherAppState app = LauncherAppState.getInstance(); final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); return Math.min(getMeasuredHeight(), mIsHotseatLayout ? grid.hotseatCellHeightPx : grid.cellHeightPx); }
原来这里会通过会通过判断是否是HotSeat而去设置icon的宽高。到这里Hotseat显示名称的分析就结束了。
0 0
- Launcher3 HotSeat显示名称
- Launcher3 Hotseat布局
- android去掉Launcher3中的hotseat
- launcher3的hotseat的图标文字处理
- Launcher3源码浅析(5.1)--Hotseat
- Launcher3--launcher3 icon以及hotseat size大小修改
- Android 6.0的Launcher3的关于Hotseat的浅析
- Launcher3将hotseat栏固定,禁止拖动,禁止形成文件夹
- 修改Launcher3的Hotseat的位置到右侧的方法
- Android Launcher3在Hotseat中将AllappsButton 替换成普通shortcut
- android launcher3将桌面较长的图标名称显示完整解决方案
- (7)Launcher3客制化之,修改单屏幕后,Fix在Hotseat拖动应用删除报错
- Android Launcher3修改行数,列数,布局等;隐藏HostSeat,使用户无法拖拽应用图标到Hotseat
- launcher3
- Launcher3
- Launcher hotseat上icon显示文字的修改
- android 让Launcher Hotseat中的图标显示title
- Laucnher3如何实现给hotseat上的应用显示title
- ROS_Xmlrpc++ 简单示例
- 对程序员最好的建议是什么?
- 1.深入浅出Java垃圾回收机制
- JSP九大内置对象及四个作用域(一)
- 2016多校联赛2D La Vie en rose(hdu 5745)
- Launcher3 HotSeat显示名称
- Linux内核中的中断栈与内核栈的补充说明
- Android自定义view实现扇形
- VMware克隆虚拟机 eth0: unknown interface: No such device
- JMeter 入门 操作
- php加密函数使用
- IE8二三事
- apache的FileUtils方法大全
- Linux 虚拟串口(可用于在本机上模拟串口进行调试)