Android TitleBar推荐

版权声明:本文为xing_star原创文章,转载请注明出处!html

本文同步自http://javaexception.com/archives/206java

Android TitleBar推荐

这段时间在帮别人写一个App,为了加快进度,就引入了一些开源库,其中一个是TitleBar,Github上的地址是   https://github.com/loperSeven/TitleBar , slogan是知足各类平常使用的标题栏,不要让你的时间浪费在写标题栏上。听起来很不错。
 
在build.gradle里面引入远程依赖
implementation 'com.github.loperSeven:TitleBar:1.0.3'
 
在activity或者是fragment的xml布局里面只须要使用TitleBar就能够了,如 < com.loper7.layout.TitleBar
android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    tl:tBackgroundColor="@color/colorPrimary"
    tl:tTitleText="活动"
    tl:tTitleTextColor="@color/black"
    tl:tCenterTitle="true"
    tl:tTitleTextBold="true"
    tl:tTitleTextSize="18sp" />

 

上面基本上默认的配置,若是须要设置左边的返回箭头,可使用tBackImage来设置箭头图标。
其余的属性用法,能够参考文档或者是源码,比较简单。
这样后续就不用重复的写titleBar了。
 
相关文章
相关标签/搜索