我正在使用 roughike bottombar 在我的项目中浏览片段,我正在尝试为我的 bottombar 设置一个可绘制的背景,但这样做有困难。官方指南https://github.com/roughike/BottomBar中的示例仅显示如何更改条形的颜色。有什么可能的方法吗?
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
}
}
});
我正在尝试使用 setBackground 但无法获得任何运气。