【发布时间】:2016-07-18 10:28:38
【问题描述】:
【问题讨论】:
-
请分享您的尝试,以便更好地帮助您
【问题讨论】:
【讨论】:
我建议你,你需要为底部导航创建自定义形状,创建底部导航见Bottom Navigation然后给选定的选项阴影,阴影检查this,
public class ThreeButtonsActivity extends AppCompatActivity {
private CoordinatorLayout coordinatorLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_three_buttons);
coordinatorLayout = (CoordinatorLayout) findViewById(R.id.three_buttons_activity);
BottomBar bottomBar = BottomBar.attach(this, savedInstanceState);
bottomBar.setItemsFromMenu(R.menu.three_buttons_menu, new OnMenuTabSelectedListener() {
@Override
public void onMenuItemSelected(int itemId) {
switch (itemId) {
case R.id.recent_item:
Snackbar.make(coordinatorLayout, "Recent Item Selected", Snackbar.LENGTH_LONG).show();
break;
case R.id.favorite_item:
Snackbar.make(coordinatorLayout, "Favorite Item Selected", Snackbar.LENGTH_LONG).show();
break;
case R.id.location_item:
Snackbar.make(coordinatorLayout, "Location Item Selected", Snackbar.LENGTH_LONG).show();
break;
}
}
});
// Set the color for the active tab. Ignored on mobile when there are more than three tabs.
bottomBar.setActiveTabColor("#C2185B");
// Use the dark theme. Ignored on mobile when there are more than three tabs.
//bottomBar.useDarkTheme(true);
// Use custom text appearance in tab titles.
//bottomBar.setTextAppearance(R.style.MyTextAppearance);
// Use custom typeface that's located at the "/src/main/assets" directory. If using with
// custom text appearance, set the text appearance first.
//bottomBar.setTypeFace("MyFont.ttf");
}
}
【讨论】: