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了。
 
相關文章
相關標籤/搜索