Android Highlight Indicator Layer Tips

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.