Giter VIP home page Giter VIP logo

viewtooltip's Introduction

bage week_download month_download build status

Features

  • show tip anywhere
  • show tip with gravity
  • show tip with animation including fade, slide, scale and reveal
  • set arrow location automatically
  • customize arrow width and height

Preview

Demo Download

Usage

  1. Add it in your root build.gradle at the end of repositories
allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}
  1. Add the dependency

bage

dependencies {
    ...
    implementation 'com.github.ijkzen:ViewToolTip:<latest_version>'
}

Practice

  1. Example
val tip1 = ViewToolTip.on(mBinding.text1)
            .customView(binding1.root)
            .gravity(TipGravity.BOTTOM)

tip1.show()
  1. Configure ViewToolTip by chaining commands
interface ToolTipConfiguration {
    fun customView(contentView: View): ViewToolTip
    
    // Set animation for popupWindow, support fade, slide, scale and reveal
    fun animation(type: AnimationType): ToolTipConfiguration

    // For gravity top or bottom, PopupWindow will match screen width.
    fun widthMatchParent(match: Boolean): ViewToolTip

    // PopupWindow show around targetView, left, top, right or bottom.
    fun gravity(gravity: TipGravity): ViewToolTip

    // width for arrow pointing to the targetView.
    fun arrowWidth(width: Int): ViewToolTip

    // height for arrow pointing to the targetView, at most 10 dp.
    fun arrowHeight(height: Int): ViewToolTip

    // color for arrow pointing to the targetView
    fun arrowColor(color: Int): ViewToolTip

    // set background for popupWindow
    fun background(background: GradientDrawable): ViewToolTip

    // set background color for popupWindow 
    fun backgroundColor(color: Int): ViewToolTip

    // set background radius for popupWindow 
    fun backgroundRadius(radius: Int): ViewToolTip

    // set text for popupWindow if not customView
    fun text(text: CharSequence): ViewToolTip

    // set text color if not customView
    fun textColor(color: Int): ViewToolTip

    // set text size if not custmView
    fun textSize(size: Float): ViewToolTip

    //  set text alignment if not custmView
    fun textAlign(align: Int): ViewToolTip

    // show grey background for popupWindow or not
    fun isShowMaskBackground(show: Boolean): ViewToolTip

    // dismiss popupWindow when clicking grey background 
    fun isAllowHideByClickMask(allow: Boolean): ViewToolTip

    // dimiss popupWindow when clicking popupWindow
    fun isAllowHideByClickTip(allow: Boolean): ViewToolTip

    // dimiss popupWindow after sometime
    fun isAutoHide(auto: Boolean): ViewToolTip

    // sometime above
    fun displayTime(duration: Long): ViewToolTip

    // set tag for popupWindow
    fun setTag(tag: String): ViewToolTip

    // if tag == mTag, popupWindow will keep showing, otherwise, popupWindow will dismiss
    fun notify(tag: String?)
}

More

If you have any questions, please ask me here

Support

Thanks to JetBrains for supporting this project!

viewtooltip's People

Contributors

ijkzen avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.