Open mehdiwaysi opened 3 years ago
I can find it using
I can find it using
instead of but my app crashes when I add Model in java...
Did you find a solution?
"Did you find a solution?"... he didn't answer back, which means no, or he died of covid.
mine also crashed by the way. Also java.
I can find it using
instead of but my app crashes when I add Model in java... Did you find a solution?
I had to downgrade the dependency version in order to run the app. If you do not have any problem with downgrading then
Add the dependencies:
dependencies {
...
implementation 'com.etebarian:meow-bottom-navigation:1.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.20"
...
}
Add XML Widget:
<com.etebarian.meowbottomnavigation.MeowBottomNavigation
android:id="@+id/bottom_nav_meow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:mbn_backgroundBottomColor="#ffffff"
app:mbn_circleColor="#ffffff"
app:mbn_countBackgroundColor="#ff6f00"
app:mbn_countTextColor="#ffffff"
app:mbn_defaultIconColor="#90a4ae"
app:mbn_rippleColor="#2f424242"
app:mbn_selectedIconColor="#3c415e"
app:mbn_shadowColor="#1f212121" />
Java:
public class MainActivity extends AppCompatActivity {
private MeowBottomNavigation bottomNavigation_meow;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bottomNavigation_meow = findViewById(R.id.bottom_nav_meow);
bottomNavigation_meow.add(new MeowBottomNavigation.Model(1,R.drawable.ic_launcher_foreground));
bottomNavigation_meow.add(new MeowBottomNavigation.Model(2,R.drawable.ic_launcher_foreground));
bottomNavigation_meow.add(new MeowBottomNavigation.Model(3,R.drawable.ic_launcher_foreground));
bottomNavigation_meow.show(1,true);
bottomNavigation_meow.setOnClickMenuListener(new Function1<MeowBottomNavigation.Model, Unit>() {
@Override
public Unit invoke(MeowBottomNavigation.Model model) {
switch (model.getId()){
case 1:
Toast.makeText(bottomNavigation_meow.getContext(), "Button 1 Clicked", Toast.LENGTH_SHORT).show();
break;
case 2:
Toast.makeText(bottomNavigation_meow.getContext(), "Button 2 Clicked", Toast.LENGTH_SHORT).show();
break;
case 3:
Toast.makeText(bottomNavigation_meow.getContext(), "Button 3 Clicked", Toast.LENGTH_SHORT).show();
break;
}
return null;
}
});
}
}
This inspection reports that different IDE and Gradle plugin versions are used. This can cause inconsistencies between IDE and Gradle builds in error reporting or code behaviour.
how will i fix this kind of error. pls someone guide me
I can find it using
instead of but my app crashes when I add Model in java... Did you find a solution?
I had to downgrade the dependency version in order to run the app. If you do not have any problem with downgrading then
Add the dependencies:
dependencies { ... implementation 'com.etebarian:meow-bottom-navigation:1.2.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.20" ... }
Add XML Widget:
<com.etebarian.meowbottomnavigation.MeowBottomNavigation android:id="@+id/bottom_nav_meow" android:layout_width="match_parent" android:layout_height="wrap_content" app:mbn_backgroundBottomColor="#ffffff" app:mbn_circleColor="#ffffff" app:mbn_countBackgroundColor="#ff6f00" app:mbn_countTextColor="#ffffff" app:mbn_defaultIconColor="#90a4ae" app:mbn_rippleColor="#2f424242" app:mbn_selectedIconColor="#3c415e" app:mbn_shadowColor="#1f212121" />
Java:
public class MainActivity extends AppCompatActivity { private MeowBottomNavigation bottomNavigation_meow; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bottomNavigation_meow = findViewById(R.id.bottom_nav_meow); bottomNavigation_meow.add(new MeowBottomNavigation.Model(1,R.drawable.ic_launcher_foreground)); bottomNavigation_meow.add(new MeowBottomNavigation.Model(2,R.drawable.ic_launcher_foreground)); bottomNavigation_meow.add(new MeowBottomNavigation.Model(3,R.drawable.ic_launcher_foreground)); bottomNavigation_meow.show(1,true); bottomNavigation_meow.setOnClickMenuListener(new Function1<MeowBottomNavigation.Model, Unit>() { @Override public Unit invoke(MeowBottomNavigation.Model model) { switch (model.getId()){ case 1: Toast.makeText(bottomNavigation_meow.getContext(), "Button 1 Clicked", Toast.LENGTH_SHORT).show(); break; case 2: Toast.makeText(bottomNavigation_meow.getContext(), "Button 2 Clicked", Toast.LENGTH_SHORT).show(); break; case 3: Toast.makeText(bottomNavigation_meow.getContext(), "Button 3 Clicked", Toast.LENGTH_SHORT).show(); break; } return null; } }); } }
Thanks Solved the issue
I acted according to the documentation and added the required libraries to the dependency, but it is not recognized in the XML file. in java project