我们知道 Android的桌面 和ios 实现效果有本质的区别,如果想实现ios 的效果,就要高度定制才可以实现,今天我们就用些巧妙的办法来实现hotseat放ios 效果
首先我们想到的就是图标移动后,其他图标居中显示,那就要在workspace 的ondrop下来实现,下面我们将一步一步来实现
首先在opdrop下调用此方法
resetHotseatLayout(false, -1);
public void resetHotseatLayout(boolean isAdded, int targetCellX) {
int numHotseatIcons = mLauncher.getDeviceProfile().inv.numHotseatIcons;
int j = 0;
int mMargins = 0;
for (int i = 0; i <= numHotseatIcons; i++) {
View child = mLauncher.getHotseat().getLayout().getShortcutsAndWidgets().getChildAt(i,0);
if(child != null) {
CellLayout.LayoutParams clp = (CellLayout.LayoutParams) child.getLayoutParams();
clp.cellX = j;
j++;
final ItemInfo info = (ItemInfo) child.getTag();
mLauncher.getModelWriter().modifyItemInDatabase(info, LauncherSettings.Favorites.CONTAINER_HOTSEAT, -1,