android target tooltip
Release 2.0.5
创建类似工具提示的 Toast,可以指定物理目标,甚至屏幕上的点。许多附加功能和定制。只需查看示例活动即可。
implementation ' it.sephiroth.android.library.targettooltip:target-tooltip-library:**version** '
步骤 1.将 JitPack 存储库添加到您的构建文件中:
allprojects {
repositories {
.. .
maven { url ' https://jitpack.io ' }
}
}
步骤2.添加依赖
dependencies {
implementation ' com.github.sephiroth74:android-target-tooltip:Tag '
}
在 JitPack 上获取最新版本
val tooltip = Tooltip . Builder ( Context )
.anchor( View , Int , Int , Boolean )
.anchor( Int , Int )
.text( CharSequence )
.styleId( Int )
.typeface( Typeface )
.maxWidth( Int )
.arrow( Boolean )
.floatingAnimation( Tooltip . Animation )
.closePolicy( ClosePolicy )
.showDuration( Long )
.fadeDuration( Long )
.overlay( Boolean )
.create()
tooltip
.doOnHidden { }
.doOnFailure { }
.doOnShown { }
.show( View , Tooltip . Gravity , Boolean )
请参阅内部 Builder 类以获取完整的选项集
可以在样式对象中自定义工具提示样式:
<!-- default style -->
< declare-styleable name = " TooltipLayout " >
< attr name = " ttlm_padding " format = " dimension " />
< attr name = " ttlm_strokeColor " format = " color " />
< attr name = " ttlm_backgroundColor " format = " color " />
< attr name = " ttlm_strokeWeight " format = " dimension " />
< attr name = " ttlm_cornerRadius " format = " dimension " />
< attr name = " ttlm_arrowRatio " format = " float " />
< attr name = " android:textAppearance " />
< attr name = " ttlm_overlayStyle " format = " reference " />
< attr name = " ttlm_elevation " format = " dimension " />
<!-- font file path inside your assets folder -->
< attr name = " ttlm_font " format = " string " />
<!-- textview text gravity -->
< attr name = " android:gravity " />
</ declare-styleable >
这是覆盖触摸的样式:
< declare-styleable name = " TooltipOverlay " >
< attr name = " android:color " />
< attr name = " android:alpha " />
< attr name = " ttlm_repeatCount " format = " integer " />
< attr name = " ttlm_duration " format = " integer " />
< attr name = " android:layout_margin " />
</ declare-styleable >
然后在Builder方法中传递样式withStyleId(int resId)
麻省理工学院许可证
查看许可证