'chip navigation bar animation not works
i used this GitHub library in my code for bottom navigation.chip navigation bar i tried to make it floating up after starting the program.but when run the program it is disappeared but when clicking in the buttons place . on click listener works but i couldn't see the navigation bar this is the click listener ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btmNav = findViewById(R.id.btmNav);
layout = findViewById(R.id.cntBTM);
animMove = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_up);
btmNav.startAnimation(animMove);
//////////////*
if (savedInstanceState == null) {
NewsFragment newsFragment = new NewsFragment();
fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.fragmentContainer, newsFragment)
.commit();
}
btmNav.setOnItemSelectedListener(new ChipNavigationBar.OnItemSelectedListener() {
@Override
public void onItemSelected(int id) {
Fragment fragment = null;
switch (id) {
case R.id.home:
fragment = new WebFragment();
break;
case R.id.activity:
fragment = new ActivityFragment();
break;
case R.id.settings:
fragment = new SettingFragment();
break;
}
if (fragment != null) {
fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.fragmentContainer, fragment)
.commit();
} else {
Log.e(TAG, "Error in creating fragment");
}
}
});
and this in main activity
<com.ismaeldivita.chipnavigation.ChipNavigationBar
android:id="@+id/btmNav"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_margin="12dp"
android:background="@drawable/rounded"
android:elevation="5dp"
android:outlineAmbientShadowColor="@color/colorAccent"
app:cnb_menuResource="@menu/bottom_menu"
app:cnb_unselectedColor="#fff"
Solution 1:[1]
Use this library https://github.com/ismaeldivita/chip-navigation-bar
Dont forget to add maven in settings.graddle
maven { url 'https://jitpack.io' }
And dont forget to add this dependency to your build.graddle file
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.0'
Solution 2:[2]
add your build.gradle
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.72'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | TurboLight |
Solution 2 | ?ageldi Alyýew |