ittianyu / BottomNavigationViewEx

An android lib for enhancing BottomNavigationView. 一个增强BottomNavigationView的安卓库。
MIT License
3.47k stars 558 forks source link

Text is not showing with the icon in API LEVEL 28 #131

Closed Avinash4201 closed 6 years ago

Avinash4201 commented 6 years ago

As per your documentation, we have to use this dependency for API LEVEL 28 "implementathecion 'com.github.ittianyu:BottomNavigationViewEx:2.0.2'". After adding this dependency text is not showing with Icons so please check and confirm me.

ittianyu commented 6 years ago

You can download the demo and have a try. I not sure what wrong. Please put some code.

Avinash4201 commented 6 years ago

Build.gradle dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:support-v4:28.0.0' implementation 'com.android.support:design:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1' implementation 'com.kaopiz:kprogresshud:1.2.0' implementation 'com.github.ittianyu:BottomNavigationViewEx:2.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.android.support:cardview-v7:28.0.0' implementation 'com.github.clans:fab:1.6.4' }

2 XML

<com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx android:id="@+id/bottom_navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" app:elevation="12dp" android:layout_gravity="bottom" app:menu="@menu/bottom_nav_menu" android:theme="@style/Widget.BottomNavigationView" app:itemIconTint="@drawable/selector_color_item"/>

  1. Activity

BottomNavigationViewEx bottomNavigationView = (BottomNavigationViewEx) findViewById(R.id.bottom_navigation); bottomNavigationView.enableAnimation(true); bottomNavigationView.enableShiftingMode(false); bottomNavigationView.enableItemShiftingMode(false); bottomNavigationView.setIconSize(24, 24); bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.action_home: Toast.makeText(CustomerListActivity.this, "Home", Toast.LENGTH_SHORT).show(); break; case R.id.action_lead: Toast.makeText(CustomerListActivity.this, "Lead", Toast.LENGTH_SHORT).show(); break; case R.id.action_contact: Toast.makeText(CustomerListActivity.this, "Contact", Toast.LENGTH_SHORT).show(); break; case R.id.action_person: Toast.makeText(CustomerListActivity.this, "Account", Toast.LENGTH_SHORT).show(); break; case R.id.action_event: Toast.makeText(CustomerListActivity.this, "Events", Toast.LENGTH_SHORT).show(); break;

            }

            return true;
        }

    });

Bro I have tried with API Level 27, in this level it is working fine but API level 28 it is not working.

ittianyu commented 6 years ago

delete the line and try again.

bottomNavigationView.setIconSize(24, 24);

If not work. remove these and try again

bottomNavigationView.enableAnimation(true);
bottomNavigationView.enableShiftingMode(false);
bottomNavigationView.enableItemShiftingMode(false);
Avinash4201 commented 6 years ago

Now it working after added the "bottomNavigationView.setTextSize(12);".

Thank you for helping me.