项目作者: aqua30

项目描述 :
Tabs with fontawesome support.
高级语言: Java
项目地址: git://github.com/aqua30/FontAwesomeTab.git
创建时间: 2015-05-27T16:26:07Z
项目社区:https://github.com/aqua30/FontAwesomeTab

开源协议:MIT License

下载


FontAwesomeTab

Tabs with fontawesome support. This library is created to customize the feel for tabs. Now you can add images using fontawesome. Customize the color for the tab image and its indicator according to your need.
No need to use png files and hence reduce your apk size.

Screenshot

Sample screen 1

alt text

Sample screen 2

alt text

How to use:

Import this library as a library project in your workspace and reference your project with this library.

In XML

  1. com.tabswithfontawesome.views.TabLayout
  2. android:id="@+id/tabLayout"
  3. android:layout_width="match_parent"
  4. android:layout_height="48dp"
  5. tab:tab_background_color="#95a5a6"
  6. tab:tab_child_count="5"
  7. tab:tab_image_focussed_color="#e74c3c"
  8. tab:tab_image_size="20"
  9. tab:tab_image_unfocussed_color="#bdc3c7"
  10. tab:tab_indicator_focussed_color="#e74c3c"
  11. tab:tab_indicator_unfocussed_color="#bdc3c7" >

In Java

  1. TabLayout tabLayout = (TabLayout)findViewById(R.id.tabLayout);
  2. tabLayout.setTabImagesArray(getResources().getStringArray(R.array.image_array));
  3. tabLayout.setTabClickListener(this);
  4. tabLayout.attachViewPager(pager);
  5. tabLayout.createTabs();

Assets:

Add FontAwesome.otf file for fontawesome library

In strings.xml: Define your image array as

  1. <string-array name="image_array">
  2. <item></item>
  3. <item></item>
  4. <item></item>
  5. <item></item>
  6. </string-array>

PS:Make sure your view pager page count and images count should be same otherwise default image would be added.

Sample project coming soon.