android launcher2开发之 有抽屉改成无抽屉



在launcher.java中在createShortcut方法中   屏蔽所有应用按钮
改动之前
View createShortcut(int layoutResId, ViewGroup parent, ShortcutInfo info) {
BubbleTextView favorite = (BubbleTextView) mInflater.inflate(
layoutResId, parent, false);
favorite.applyFromShortcutInfo(info, mIconCache);
favorite.setOnClickListener(this);
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS
&& info.getIcon(mIconCache) == null) {
// All apps icon
// Drawable d =
// getResources().getDrawable(R.drawable.all_apps_button_icon);
Drawable d = mHotseat.getAppsButtonBitmap();// qijinling

Utilities.resizeIconDrawable(d);
favorite.setCompoundDrawables(null, d, null, null);
favorite.setOnTouchListener(getHapticFeedbackTouchListener());
}
Utilities.applyTypeface(favorite);
return favorite;
}




改动之后
 */
View createShortcut(int layoutResId, ViewGroup parent, ShortcutInfo info) {
BubbleTextView favorite = (BubbleTextView) mInflater.inflate(
layoutResId, parent, false);
favorite.applyFromShortcutInfo(info, mIconCache);
favorite.setOnClickListener(this);
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS
&& info.getIcon(mIconCache) == null) {
// All apps icon
Drawable d = getResources().getDrawable(
R.drawable.all_apps_button_icon);


// 隐藏菜单
favorite.setWidth(0);
favorite.setHeight(0);
favorite.setVisibility(View.GONE);
Utilities.resizeIconDrawable(d);
favorite.setCompoundDrawables(null, d, null, null);
favorite.setOnTouchListener(getHapticFeedbackTouchListener());
}
Utilities.applyTypeface(favorite);
return favorite;
}










然后在AppsCustomizePagedView类中 找到DISABLE_ALL_APPS 属性




  //无抽屉true  同理反之
    public static boolean DISABLE_ALL_APPS = true;   属性设置 TRUE 或者FAULE

android launcher2开发之 有抽屉改成无抽屉,布布扣,bubuko.com

android launcher2开发之 有抽屉改成无抽屉

上一篇:Android 创建单例模式的几种方法


下一篇:apple air装双系统(win7)