Skip to content

string-lzc/LightActionBar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

LightActionBar

1、setup

gradle user

To get a Git project into your build:

Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Step 2. Add the dependency

	dependencies {
		compile 'com.github.string-lzc:LightActionBar:v1.0.1'
	}

That's it!

2、usage

for example:

new LightActionbar(MainActivity.this).builder()
        .setTitile("title")
        .build();

And there are more methods to optimize the action bar.

more method:

   /**
     * constructor
     */
    public LightActionBar(Context context)
   /**
     * set title
     * @param title
     * @return LightActionBar
     */
    public LightActionBar setTitle(String title)
    /**
     * set color of actionbar
     * @param color
     * @return LightActionBar
     */
    public LightActionBar setBarColor(int color,boolean barTextColor)
    /**
     * set title color
     * @param color
     * @return LightActionBar
     */
    public LightActionBar setTitleColor(int color)
    
    /**
     * set left text view
     * @param textColor
     * @param text
     * @param viewOnclickListener
     * @return LightActionBar
     */
    public LightActionBar setLeftTextView(int textColor,String text,View.OnClickListener viewOnclickListener)
    /**
     * set right text view
     * @param textColor
     * @param text
     * @param viewOnclickListener
     * @return LightActionBar
     */
    public LightActionBar setRightTextView(int textColor,String text,View.OnClickListener viewOnclickListener)

    /**
     * set left image view
     * @param img
     * @param imgViewColor
     * @param onClickListener
     * @return LightActionBar
     */
    public LightActionBar setLeftImgView(int img, int imgViewColor, View.OnClickListener onClickListener)
    /**
     * set right image view
     * @param img
     * @param imgViewColor
     * @param onClickListener
     * @return LightActionBar
     */
    public LightActionBar setRightImgView(int img, int imgViewColor, View.OnClickListener onClickListener)

That's all!

About

基于AppCompat的轻量级action bar的封装

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages