This library comes from the hand of Xiang God and is absolutely convenient to use.
Implementation code
Package Com.jock.highlight;import Android.app.activity;import Android.graphics.rectf;import android.os.Bundle; Import Android.view.view;import Android.widget.toast;import Com.jock.lib.highlight;public class MainActivity extends Activity{private HighLight mhightlight; @Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate ( Savedinstancestate); Setcontentview (R.layout.activity_main); Findviewbyid (r.id.id_btn_amazing). Post (New Runnable ( {@Overridepublic void Run () {showtipmask ();}});} private void Showtipmask () {mhightlight = new HighLight (mainactivity.this)//.anchor (Findviewbyid (R.id.id_container)) Assuming that the activity is added to the guide layer, there is no need to set Anchor.addhighlight (R.id.id_btn_important, r.layout.info_up, new Highlight.onposcallback () {@Overridepublic void GetPos (float rightMargin, float bottommargin, RECTF RECTF, Highlight.margininfo margininfo) { System.out.println ("Rectf.right" + rectf.right); System.out.println ("Rectf.width ()" + rectf.width ()); System.out.println ("Rectf.bottom" + rectf.bottom); SysteM.out.println ("--------------------------------------------------------------------"); Margininfo.leftmargin = Rectf.right-rectf.width ()/2;margininfo.topmargin = Rectf.bottom;}}). Addhighlight (r.id.id_btn_amazing, R.layout.info_down, New Highlight.onposcallback () {/** * @param rightMargin * Highlight view right margin in anchor * @param bottommargin * Highlight view bottom margin in anchor * @param RECTF * Highlight View L,t,r,b,w,h * @param margininfo * Set the location of your layout. General Settings L,t or r,b */@Overridepublic void GetPos (float rightMargin, float bottommargin, RECTF RECTF, Highlight.margininfo Margininfo) {System.out.println ("RightMargin" + rightMargin); System.out.println ("Rectf.width ()" + rectf.width ()); System.out.println ("Rectf.height ()" + rectf.height ()); System.out.println ("bottommargin" + bottommargin); System.out.println ("--------------------------------------------------------------------"); Margininfo.rightmargin = RightMargin + rectf.width ()/2;margininfo.bottommargin = BottomMargin + Rectf.heigHT ();}}); Mhightlight.show ();} public void Remove (view view) {Mhightlight.remove ();} public void Add (view view) {Mhightlight.show ();}}
Source
Android Highlight Indicator Layer Tips