Android launcher2 让Hotseat/底部菜单栏的图标显示标题
来源:互联网 发布:数据展现 编辑:程序博客网 时间:2024/05/24 06:55
Launcher2的hotseat中的图标是不带标题,有些人可能觉得不够美观或者体验不好,这里我尝试地去找了一下可能原因,Hotseat之所以没能显示标题,可能由于以下因素:
1、hotseat的高度不够高
2、hotseat的标题没有设置
3、hotseat的标题被隐藏起来了
好了大概的原因就这些,根据以下步骤修改就行了。
1、Hotseat.java,找到resetLayout()方法,添加 allAppsButton.setText(R.string.all_apps_button_label);
void resetLayout() {mContent.removeAllViewsInLayout();Context context = getContext();LayoutInflater inflater = LayoutInflater.from(context);BubbleTextView allAppsButton = (BubbleTextView) inflater.inflate(R.layout.application, mContent, false);allAppsButton.setCompoundDrawablesWithIntrinsicBounds(null, context.getResources().getDrawable(R.drawable.all_apps_button_icon),null, null);allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));//添加allAppsButton.setText(R.string.all_apps_button_label);allAppsButton.setOnTouchListener(new View.OnTouchListener() {@Overridepublic boolean onTouch(View v, MotionEvent event) {if (mLauncher != null&& (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {mLauncher.onTouchDownAllAppsButton(v);}return false;}});
2、CellLayout.java,找到addViewToCellLayout()方法,注释掉 if (child instanceof BubbleTextView) {}部分
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;//// Resources res = getResources();// if (mIsHotseat) {// bubbleChild.setTextColor(res.getColor(android.R.color.transparent));// } else {// bubbleChild.setTextColor(res.getColor(R.color.workspace_icon_text_color));// }// } child.setScaleX(getChildrenScale()); child.setScaleY(getChildrenScale());
3、分别修改res/values/dimens.xml、res/values-land/dimens.xml、res/values-sw600dp/dimens.xml这3个dimens中的hotseat_cell_height的值,这里我是统一给他们加30dp,你们可以根据实际情况修改。
做完以上几步后,大功告成。
Android 4.0 Launcher2 源码 Eclipse版 :http://download.csdn.net/detail/baiyulinlin1/9620598
Android 4.0 Launcher2 源码 Eclipse版(已修改包名,不冲突系统桌面) :http://download.csdn.net/detail/baiyulinlin1/9620601
0 0
- Android launcher2 让Hotseat/底部菜单栏的图标显示标题
- android 让Launcher Hotseat中的图标显示title
- Android launcher2 隐藏hotseat上面的分隔线
- android 隐藏底部的 菜单栏
- android Launcher hotseat上图标拖动事件触动的时间
- toolBar 菜单栏不显示图标的问题
- android实现底部菜单栏
- android实现底部菜单栏
- Android底部菜单栏设计
- android底部菜单栏demo
- android底部菜单栏实现
- android底部菜单栏
- Android底部菜单栏
- Android--底部菜单栏实现
- android底部菜单栏demo
- android底部菜单栏demo .
- Android底部菜单栏
- Android 底部菜单栏实现
- 随笔日记(三)
- Unity模型部分隐藏着色器
- [LeetCode] 169. Majority Element
- js foreach中循环的时候获得对应的列中的值
- vector,list,deque
- Android launcher2 让Hotseat/底部菜单栏的图标显示标题
- DateFormat格式化日期对象
- Unity 3d脚本加密方案
- C/C++进阶学习笔记(二) 容器vector
- Java7中NIO学习之Path
- poj-1852-Ants【思维】
- Map获取值的方式
- js-标签或控件的显示与隐藏
- U盘安装win 10