Skip to content

这个项目主要实现一些非常有用的自定义View,比如TagGroup、BadgeView... 会持续更新。这个项目不求自定义View做的有多么酷炫,只求揭示最本质的原理,方便读者在实际场景中灵活使用!

Notifications You must be signed in to change notification settings

xudjx/DjCustomView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

DjCustomView

This is a project for some useful customView, such as TagGroup, BadgeView ...

自定义TagGroup

自定义BadgeView

用法非常简单:

1、在xml中用BadgeLayout将要显示Badge的结构包起来

<com.dj.custom.badgeview.BadgeLayout
    android:id="@+id/badge3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:badgeColor="#e65446"
    app:badgeOffSetX="0.6"
    app:badgeOffSetY="0.3"
    app:badgePaddingBottom="2dp"
    app:badgePaddingLeft="4dp"
    app:badgePaddingRight="4dp"
    app:badgePaddingTop="2dp"
    app:badgeTextColor="#ffffff"
    app:badgeType="text">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|bottom"
        android:src="@mipmap/ic_launcher"/>
</com.dj.custom.badgeview.BadgeLayout>

2、在代码中动态设置

badgeLayout3.setBadgeType(BadgeView.BadgeType.TEXT);
badgeLayout3.setBadgeText("新活动");

实际效果

About

这个项目主要实现一些非常有用的自定义View,比如TagGroup、BadgeView... 会持续更新。这个项目不求自定义View做的有多么酷炫,只求揭示最本质的原理,方便读者在实际场景中灵活使用!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages