안녕하세요, 저는 roughike Bottombar을 사용 중이며 5 개의 다른 탭으로 OnTabSelectedListener를 만들고 싶습니다. 현재 3 개의 다른 탭으로 작동하지만 4 또는 5 탭을 추가하려고 할 때 탭의 특정 ID를 찾을 수 없습니다.특정 ID 찾기 - Android Java
내 코드는 지금이 바로 다음과 같습니다
bbMainNavigation.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelected(@IdRes int tabId) {
Fragment fMainContent = null;
if (tabId == R.id.tBarFriends) {
cMainFragment = FriendsFragment.class;
} else if (tabId == R.id.tBarMessage) {
cMainFragment = MessagesFragment.class;
} else if (tabId == R.id.tBarRadar) {
cMainFragment = RadarFragment.class;
} else if (tabId == R.id.tBarAccount){
cMainFragment = AccountFragment.class;
}
의 탭에 내 XML은 다음과 같습니다
<?xml version="1.0" encoding="utf-8"?>
<resources>
<tabs>
<tab
icon="@drawable/friends"
id="@+id/tBarFriends"
title="Friends" />
<tab
icon="@drawable/message"
id="@+id/tBarMessage"
title="Message" />
<tab
icon="@drawable/radar"
id="@+id/tBarRadar"
title="Radar" />
<tab
icon="@drawable/account"
id="[email protected]/tBarAccount"
title="Account" />
<tab
icon="@drawable/settings"
id="[email protected]/tab_settings"
title="Settings" />
</tabs>
</resources>
내가하려고하면 내가 코드를 실행하자. 때문에 오류 :
Error:(40, 41) error: cannot find symbol variable tBarAccount
나는 너희들이 사람에 XML에 마지막이`에게 id`s 비교 좀 도와
을 할 수 있기를 바랍니다 위. 당신은'+'와'@'swapped -'id = "+ @ id/tBarAccount"를 얻었습니다. –