FlycoLabelView Documentation

repository·master·Indexed 21 days ago

https://github.com/h07000223/flycolabelview

A simple Android custom view for displaying labels, tags, or badges with optional triangle-shaped background decorations. Supports customization via XML attributes for text properties, colors, sizing, and orientation.

Tokens
900
Snippets
3
Records
4
Agent score
25%

What's inside FlycoLabelView

  1. Install FlycoLabelView via Gradle

    master

    To use FlycoLabelView in your Android project, add the following dependency to your build.gradle file. Note that it uses the @aar suffix to specify the artifact type.

    dependencies{
        compile 'com.flyco.labelview:FlycoLabelView_Lib:1.0.2@aar'
    }
  2. Configure FlycoLabelView attributes

    master

    FlycoLabelView supports several XML attributes for customizing the appearance and behavior of the label. Use these attributes in your layout XML files to set text properties, colors, sizing, and the triangle fill effect.

    | name | format | description |
    |:---:|:---:|:---:|
    | lv_text | string | set text |
    | lv_text_color | color | set text color default #ffffff |
    | lv_text_size | dimension | set text size default 11sp |
    | lv_text_bold | boolean | set text bold default true |
    | lv_text_all_caps | boolean | set text all caps default true |
    | lv_background_color | color | set LabelView background color default #FF4081 |
    | lv_min_size | dimension | min size of rect of LabelView default mFillTriangle?35dp:50dp |
    | lv_padding | dimension |set paddingTop and paddingBottom of text default 3.5dp, invalid when mFillTriangle true |
    | lv_gravity | enum |set LabelView gravity TOP_LEFT or TOP_RIGHT or BOTTOM_LEFT or BOTTOM_RIGHT default TOP_LEFT |
    | lv_fill_triangle | boolean | set fill triangle area, default false |
  3. Configure FlycoLabelView via XML attributes

    master

    You can customize the appearance and behavior of the FlycoLabelView directly in your XML layout files using the following attributes:

    AttributeFormatDescription
    lv_textstringSets the text content
    lv_text_colorcolorSets the text color (default: #ffffff)
    lv_text_sizedimensionSets the text size (default: 11sp)
    lv_text_boldbooleanEnables bold text (default: true)
    lv_text_all_capsbooleanEnables all-caps text (default: true)
    lv_background_colorcolorSets the background color (default: #FF4081)
    lv_min_sizedimensionMinimum width/height of the LabelView (default: 35dp or 50dp depending on lv_fill_triangle)
    lv_paddingdimensionVertical padding for text (default: 3.5dp; ignored if lv_fill_triangle is true)
    lv_gravityenumSets the label orientation (supports top-left, top-right, bottom-left, bottom-right; default: top-left)
    lv_fill_trianglebooleanWhether to fill the triangle area (default: false)