项目作者: AlexLiuSheng

项目描述 :
a BadeView base on android
高级语言: Java
项目地址: git://github.com/AlexLiuSheng/BadgeView.git
创建时间: 2016-07-15T03:22:59Z
项目社区:https://github.com/AlexLiuSheng/BadgeView

开源协议:

下载


BadgeView

a BadeView base on android

include:

  1. `compile 'com.allenliu.badgeview:library:1.1.1'`newest

bind like this:

  1. BadgeFactory.create(this)
  2. .setTextColor(Color.White)
  3. .setWidthAndHeight(25,25)
  4. .setBadgeBackground(Color.Red)
  5. .setTextSize(10)
  6. .setBadgeGravity(Gravity.Right|Gravity.Top)
  7. .setBadgeCount(20)
  8. .setShape(BadgeView.SHAPE_CIRCLE)
  9. .setSpace(10,10)
  10. .bind(view);

if u want to set space dont use setMargin(),use setSpace instead.

There are some other constructer methods and you can be easy to create your own shape :

  1. BadgeFactory.createDot(this).setBadgeCount(20).bind(imageView);
  2. BadgeFactory.createCircle(this).setBadgeCount(20).bind(imageView);
  3. BadgeFactory.createRectangle(this).setBadgeCount(20).bind(imageView);
  4. BadgeFactory.createOval(this).setBadgeCount(20).bind(imageView);
  5. BadgeFactory.createSquare(this).setBadgeCount(20).bind(imageView);
  6. BadgeFactory.createRoundRect(this).setBadgeCount(20).bind(imageView);

unbind view just use unbind method.

  1. badgeView.unbind();

history version

  • v1.0.6
    add setMarginmethod,using this method you can change the position of badgeview,but the width of bindview or the height of bindview will be changed.see image effect.

  • v1.1.1
    add setSpacemethod,it replace origin method setMargin.now setMargin is a Deprecated method.Use setSpace method to set space between view and badgeview instead.

License

  1. Copyright 2016 AllenLiu.
  2. Licensed to the Apache Software Foundation (ASF) under one or more contributor
  3. license agreements. See the NOTICE file distributed with this work for
  4. additional information regarding copyright ownership. The ASF licenses this
  5. file to you under the Apache License, Version 2.0 (the "License"); you may not
  6. use this file except in compliance with the License. You may obtain a copy of
  7. the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  11. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  12. License for the specific language governing permissions and limitations under
  13. the License.

welecome to star,thank you.