如何设置标签的徽章位置 [英] How to set the badge position in tabs

查看:174
本文介绍了如何设置标签的徽章位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的徽章的概念。在我的应用我想显示选项卡上的徽章。对于我所使用的Andr​​oid的viewbadger.jar文件。它工作正常,但position属性不受影响。如何设置的位置。如果您需要更多信息,请让我知道。

I am new to badge's concept. In my application i want to show the badges on the tabs. For that i used the android-viewbadger.jar file. It's working fine but position property is not effected. How to set the position. If you need more info please let me know.

TabWidget tabs = (TabWidget) findViewById(android.R.id.tabs);       
DH_Constant.badgeView = new BadgeView(this, tabs, 2);

// it's working fine

badge1.setBadgePosition(BadgeView.POSITION_CENTER);

// But I Supposed to set it as position to top_left or top_right then it still shows as bottom_left and bottom_right

badge1.setBadgePosition(BadgeView.POSITION_TOP_RIGHT);

DH_Constant.badgeView.setText(DH_Constant.MessagesCount_obj.count); 
DH_Constant.badgeView.show();

输出:

推荐答案

默认情况下它的位置是 TOP_RIGHT 。如果你想要任何其他职位,你必须设置。
例如
对于TOP_LEFT使用:

By default it's position is TOP_RIGHT. If you want any other position you have to set that. e.g For top_left use:

badge1.setBadgePosition(BadgeView.POSITION_TOP_LEFT);

有关中心使用:

badge1.setBadgePosition(BadgeView.POSITION_CENTER);

有关BOTTOM_LEFT使用:

For bottom_left use:

badge1.setBadgePosition(BadgeView.POSITION_BOTTOM_LEFT);

有关BOTTOM_RIGHT使用:

For bottom_right use:

badge1.setBadgePosition(BadgeView.POSITION_BOTTOM_RIGHT);

这篇关于如何设置标签的徽章位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆