Android Package TitleBar Basic for all general development
GitHub Address: Https://github.com/SiberiaDante/SiberiaDanteLib/blob/master/sample/src/main/notes/TitleBar.md
Main realization: (Follow-up will continue to improve, like to give a star, thank you for your support)
How to use
allprojects { repositories { ... ' Https://jitpack.io ' } }}
Dependencies { 'com.github.sibreiadante:siberiadantelib:1.0.2' }
1. In XML
Com.siberiadante.widget.TitleBar android:layout_width="match_parent" android:layout_height="wrap_content" />
2. If the project uses the immersive status bar, set the TitleBar immersion style:
Titlebar.setimmersive (true);
3, left to return off the main function: Do not display content or display pictures + text (like iOS), you can set your own pictures, text, you can also use the default text picture
titlebar.setleftimage (r.mipmap.back); Titlebar.setlefttext (" return "); Titlebar.setleftlistener (new View.onclicklistener () { @Override public void OnClick (view view) { toastutil.toast (" clicked left " ); } });
4, the right can be set up a picture or do not display content, there are monitoring events
titlebar.setrightimage (r.mipmap.search); Titlebar.setrightlistener (new View.onclicklistener () { @Override public void OnClick (view view) { toastutil.toast (" clicked Right "); } );
5, set the title (can set the main title and subtitle, you can set the font color, font, title click Listen)
Titlebar.settitle ("Various dialog component Packages"); Titlebar.setsubtitle ("Siberiadante"); Titlebar.setsubtitlecolor (Getresources (). GetColor (R.color.gray)); Titlebar.settitlelistener (NewView.onclicklistener () {@Override Public voidOnClick (view view) {Toastutil.showtextlong ("clicked on the title"); } });
6, TitleBar set the bottom split line, can be color, pictures, etc.
Titlebar.setdividebackground (Getresources (). GetColor (r.color.colorprimary));
Android Package TitleBar Basic for all general development