Я делаю нижнюю панель с реализацией com.roughike:bottom-bar:2.3.1
и хочу вызвать setOnTabSelectListener
для элементов Bottombar, но я не могу найти элементы Bottombar с помощью R.id из XML-файла.В чем моя проблема?
Мой XML из res / layout / activity_main
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottom_bar"
>
</FrameLayout>
<com.roughike.bottombar.BottomBar
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/margin_50dp"
android:layout_alignParentBottom="true"
app:bb_tabXmlResource="@xml/tab"
>
</com.roughike.bottombar.BottomBar>
</RelativeLayout>
enter code here
Мой XML из res / xml / tab
<?xml version="1.0" encoding="utf-8"?>
<tabs>
<tab
id="@+id/home_tab"
icon="@drawable/home_btn"
/>
<tab
id="@+id/search_tab"
icon="@drawable/search_btn"
/>
<tab
id="@+id/new_post_tab"
icon="@drawable/new_post_btn"
/>
<tab
id="@+id/profile_tab"
icon="@drawable/profile_btn"
/>
</tabs>
Мой класс из java /com.ms.ma/MainActivity
private void init_bottomBar(){
bottomBar = findViewById(R.id.bottom_bar);
bottomBar.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelected(int tabId) {
switch (tabId)
{
case R.id.home_tab: <--here i cant find home_tab-->
break;
}
}
});
}