I am using roughike bottombar to navigate through fragments in my project, I am trying to set a drawable background to my bottombar but is having difficulty doing so. The example in the official guide https://github.com/roughike/BottomBar only shows how to change the color of the bar. Is there any possible way to do so?
resId = R.drawable.footer_bg_02;
bottomBar = BottomBar.attach(this, savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
bottomBar.setBackground(resId);
}
bottomBar.setFragmentItems(getSupportFragmentManager(), R.id.fragmentContainer,
new BottomBarFragment(StoreList.newInstance("Content for fragment 1."), R.drawable.ic_01, "fragment 1"),
new BottomBarFragment(QRscanner.newInstance("Content for fragment 2."), R.drawable.ic_02, "fragment 2"),
new BottomBarFragment(MyBooking.newInstance("Content for fragment 3."), R.drawable.ic_03, "fragment 3"),
);
bottomBar.setOnItemSelectedListener(new OnTabSelectedListener() {
@Override
public void onItemSelected(int position) {
switch (position) {
case 0:
getSupportActionBar();
//return;
case 1:
//getSupportActionBar().hide();
case 2:
//return;
case 3:
//getSupportActionBar().hide();
case 4:
//return;
// Item 1 Selected
}
}
});
I am trying to use setBackground but cannot get any luck.
This suggestion is from issue, you can use like this:
<com.roughike.bottombar.BottomBar
android:id="@+id/bottomBar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/colorAccent"
android:layout_alignParentBottom="true"
app:bb_tabXmlResource="@xml/bottombar_tabs" />