Skip to content

donglua/SmartSkeleton

Repository files navigation

SmartSkeleton

SmartSkeleton Demo

A lightweight Android skeleton screen library with built-in shimmer animation. Views automatically show skeleton loading state and hide it when content is set.

Features

  • 🦴 SkeletonTextView — automatically shows skeleton when text is empty, hides when text is set
  • 🖼️ SkeletonImageView — automatically shows skeleton when drawable is null, hides when image is set
  • Shimmer animation — built-in smooth shimmer effect via SkeletonDrawable
  • 🧩 View extensionView.asSkeleton(show) for any View
  • 🎨 XML customizableskeletonRadius, skeletonBaseColor, skeletonHighlightColor

Setup

dependencies {
    implementation 'cn.jingzhuan.lib:skeleton:1.0.2'
}

Usage

XML Layout

<cn.jingzhuan.lib.skeleton.widget.SkeletonTextView
    android:id="@+id/tv_title"
    android:layout_width="200dp"
    android:layout_height="20dp"
    app:skeletonRadius="8dp"
    app:skeletonBaseColor="#E0E0E0"
    app:skeletonHighlightColor="#EEEEEE" />

<cn.jingzhuan.lib.skeleton.widget.SkeletonImageView
    android:id="@+id/iv_avatar"
    android:layout_width="48dp"
    android:layout_height="48dp"
    app:skeletonRadius="24dp" />

Kotlin

// SkeletonTextView: skeleton hides automatically when text is set
tvTitle.text = "Hello"

// SkeletonImageView: skeleton hides automatically when drawable is set
ivAvatar.setImageDrawable(drawable)

// Any View: use extension function
myView.asSkeleton(true)   // show
myView.asSkeleton(false)  // hide

XML Attributes

Attribute Format Default Description
skeletonRadius dimension 4dp Corner radius
skeletonBaseColor color #E0E0E0 Base color
skeletonHighlightColor color #EEEEEE Shimmer highlight color

License

Apache License 2.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages