TitleBar开源库

安装

Step 1: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.MarshallMathersIII:TitleBar:v1.0'
    }

使用

Step 1:自定义布局




    

    

    

    

    

    


Step 2:使用

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        new TitleBuilder(this)
                .setTitleText("设置")
                .setLeftImage(R.mipmap.ic_launcher)
                .setLeftOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        finish();
                    }
                });
    }
}

地址

TitleBar开源

参考

写自己的开源库,发布到 JitPack.io

你可能感兴趣的:(TitleBar开源库)