아래쪽 탐색보기에서 색조가 아닌 선택한 항목 전체 아이콘을 변경하고 싶습니다. 각 아이콘에 대한 선택기가 있지만 추가 할 위치를 모르겠습니다. 그 이미지 선택 자. 어느 누구도 해결책을 말해주십시오.Android : 하단 탐색보기 - 선택한 항목의 아이콘이 변경되지 않습니다.
코드 :
private void handleBottomNavigationItemSelected(MenuItem menuItem) {
menuItem.setChecked(true);
switch (menuItem.getItemId()) {
//Replacing the main content with ContentFragment Which is our Inbox View;
case R.id.action_calendar:
switchFragment(new PatientAppointmentStatusFragment(), "TODAY");
break;
case R.id.action_case_sheets:
switchFragment(new CaseSheetFragment(), "Case Sheet");
break;
case R.id.action_history:
switchFragment(new HistoryFragment(), "History");
break;
case R.id.action_reports:
switchFragment(new ReportsFragment(), "Reports");
break;
case R.id.action_billing:
switchFragment(new BillingFragment(), "Billing");
break;
}
}
메뉴 여기
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_calendar"
android:enabled="true"
android:icon="@drawable/menu_calendar_bg"
android:title="@string/menu_calendar"
app:showAsAction="always|withText" />
<item
android:id="@+id/action_case_sheets"
android:enabled="true"
android:icon="@drawable/menu_case_sheets_bg"
android:title="@string/menu_case_sheets"
app:showAsAction="always|withText" />
<item
android:id="@+id/action_history"
android:enabled="true"
android:icon="@drawable/menu_history_bg"
android:title="@string/menu_history"
app:showAsAction="always|withText" />
<item
android:id="@+id/action_reports"
android:enabled="true"
android:icon="@drawable/menu_reports_bg"
android:title="@string/menu_reports"
app:showAsAction="always|withText" />
<item
android:id="@+id/action_billing"
android:enabled="true"
android:icon="@drawable/menu_billing_bg"
android:title="@string/menu_billing"
app:showAsAction="always|withText" />
</menu>
는 바닥 탐색보기 XML 코드입니다.
<BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="@dimen/margin_48dp"
android:layout_alignParentBottom="true"
app:itemBackground="@drawable/tab_background"
app:itemIconTint="@color/navigation_item_color"
app:itemTextColor="@color/navigation_item_color"
app:menu="@menu/bottom_navigation_main" />
나는 다음과 같은 링크를 시도했지만 저를 위해 작동하지 않습니다.
링크 Android: Bottom Navigation View - change icon of selected item
당신은 색상 의 고해상도 폴더 으로 파일을 생성 고해상도/색상 .Into 폴더 "navigation_item_color" 이름과 사용은 다음 코드를 폴더를 만들어야합니다
다음을 수행하십시오. https://materialdoc.com/components/bottom-navigation/ – Radhey
"navigation_item_color"가 무엇인지 말해 주시겠습니까? 파일 또는 색상 이름입니까? –
@PRIYAPARASHAR 아이콘 및 텍스트 선택자 색 –