Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
roughike committed Mar 25, 2017
1 parent 6e3e1d0 commit c7e0fb5
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion README.md
Expand Up @@ -153,14 +153,39 @@ bottomBar.setTabSelectionInterceptor(new TabSelectionInterceptor() {
public boolean shouldInterceptTabSelection(@IdRes int oldTabId, @IdRes int newTabId) {
if (newTabId == R.id.tab_pro_feature && !userHasProVersion()) {
startProVersionPurchaseFlow();
return true
return true;
}

return false;
}
});
```

### Changing icons based on selection state

If you want to have different icon when a specific tab is selected, just use state list drawables.

**res/drawable/my_tab_icon.xml**

```xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_myicon_selected" android:state_selected="true" />
<item android:drawable="@drawable/ic_myicon_default" android:state_selected="false" />
</selector>
```

**res/xml/bottombar_tabs.xml**

```xml
...
<tab
id="@+id/tab_favorites"
icon="@drawable/my_tab_icon"
title="Favorites" />
<!-- You can use @color resources too! -->
...
```

### Those color changing tabs look dope. Howdoidodat?

Just add ```barColorWhenSelected``` to each tab. When that tab is selected, the whole BottomBar background color is changed with a nice animation.
Expand Down

0 comments on commit c7e0fb5

Please sign in to comment.