开源中国(三)
2016-06-18 22:51
405 查看
android:descendantFocusability用法简析
在遇到因ImageButton,Button,CheckBox等子控件(也可以说是Button或者Checkable的子类控件),此时这些子控件会将焦点获取到,而导致item没有获取焦点可设置
之后通过
在遇到因ImageButton,Button,CheckBox等子控件(也可以说是Button或者Checkable的子类控件),此时这些子控件会将焦点获取到,而导致item没有获取焦点可设置
android:descendantFocusability=”blocksDescendants”的属性
消息通知
在MianActivity中设置广播,进行广播监听,广播的总数等于各个消息的总和,判断是不
MyInformationFragment进行数值传递
private BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Constants.INTENT_ACTION_NOTICE)) { mNotice = (Notice) intent.getSerializableExtra("notice_bean"); int atmeCount = mNotice.getAtmeCount();// @我 int msgCount = mNotice.getMsgCount();// 留言 int reviewCount = mNotice.getReviewCount();// 评论 int newFansCount = mNotice.getNewFansCount();// 新粉丝 int newLikeCount = mNotice.getNewLikeCount();// 收到赞 int activeCount = atmeCount + reviewCount + msgCount + newFansCount + newLikeCount; Fragment fragment = getCurrentFragment(); if (fragment instanceof MyInformationFragment) { ((MyInformationFragment) fragment).setNotice(); } else { if (activeCount > 0) { mBvNotice.setText(activeCount + ""); mBvNotice.show(); } else { mBvNotice.hide(); mNotice = null; } } } else if (intent.getAction() .equals(Constants.INTENT_ACTION_LOGOUT)) { mBvNotice.hide(); mNotice = null; } } };
之后通过
BadgeView对数值展示,小红点的数值
mMesCount = new BadgeView(getActivity(), mMesView); //设置小红点的大小 mMesCount.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10); //设置小红点居中 mMesCount.setBadgePosition(BadgeView.POSITION_CENTER); mMesCount.setGravity(Gravity.CENTER); mMesCount.setBackgroundResource(R.drawable.notification_bg);
相关文章推荐
- 欢迎使用CSDN-markdown编辑器
- Java - PAT - 1016. 部分A+B (15)
- 对于抄袭
- linux C 学习---函数指针
- asp.net core 使用 Redis 和 Protobuf
- 开源中国学习(语音实现)
- 数据存储,线程的知识总结
- 白话空间统计番外二:空间统计与空间分析的区别(ArcGIS中)
- 关于Androidstudio的安装以及配置时候的注意事项
- scikit-learn : 优化岭回归参数alpha优化
- Unable to load native-hadoop library for your platform... using builtin-
- 逻辑回归
- 字符串按照单词为单位逆序排列
- Andrew NG 《machine learning》week 3,class5 —Solving the Problem of Overfitting
- 20150418多线程、指针与数组、结构体
- 用NSZombieEnabled解决恼人的EXC_BAD_ACCESS错误
- 剑指offer——滑动窗口的最大值
- 关于多线程GCD,小白必须知道的常用函数
- 大话设计模式-Chapter2策略模式
- Linux C 指针练习