[英]How to put badge at the right corner of a view
I am trying a badge View as suggested in this link . 我正在尝试按照此链接的建议使用徽章视图。 I am trying with this code .
我正在尝试使用此代码。
String count_str = Integer.toString(count);
TextView text_view = (TextView) findViewById(R.id.textView);
badge1 = new BadgeView(this, text_view);
badge1.setText(count_str);
badge1.show();
But the badge is appearing in the middle of the TextView. 但是徽章显示在TextView的中间。 How can I put this badge in the right corner of the TextView?
如何将这个标志放在TextView的右上角?
Looking at the source code for DemoActivity
in this library, it appears the following method is responsible for the position of the badge: 查看此库中
DemoActivity
的源代码,似乎以下方法负责DemoActivity
的位置:
badge1.setBadgePosition(BadgeView.POSITION_CENTER);
Edit 编辑
And the following options from the BadgeView
class: 以及
BadgeView
类的以下选项:
public static final int POSITION_TOP_LEFT = 1;
public static final int POSITION_TOP_RIGHT = 2;
public static final int POSITION_BOTTOM_LEFT = 3;
public static final int POSITION_BOTTOM_RIGHT = 4;
public static final int POSITION_CENTER = 5;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.