/>
2. 在 layout/activity_main.xml 中设置 BottomBar:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
android:layout_width=“match_parent”
android:layout_height=“match_parent”>
<FrameLayout
android:id=“@+id/contentContainer”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:layout_above=“@+id/bottomBar”/>
<com.roughike.bottombar.BottomBar
android:id=“@+id/bottomBar”
android:layout_width=“match_parent”
android:layout_height=“60dp”
android:layout_alignParentBottom=“true”
app:bb_behavior=“shifting”
app:bb_tabXmlResource=“@xml/bottombar_menu”/>
3.在 Activity 中设置鼠标点击之后的操作:
public class MainActivity extends AppCompatActivity {
private BottomBar bottomBar;
private BottomBarTab nearby;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bottomBar = (BottomBar) findViewById(R.id.bottomBar);
bottomBar.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelected(@IdRes int tabId) {