मुझे यकीन है कि अपनी छोटी सी समस्या के लिए एक समस्या है, लेकिन मेरे लिए यह सबसे बड़ी समस्या कभी में से एक ...BottomNavigationView
तो समस्या यह है कि मैं अपने अनुप्रयोग के लिए नीचे नेविगेशन देखें जोड़ लिया है, लेकिन मैं नीचे की जरूरत है नेविगेशन खंड के बजाय गतिविधियों के बीच देखें इसलिए मैंने अपनी सभी 3 गतिविधियों के लिए जावा में यह कोड जोड़ा है ...
समस्या यह है कि जब मैं अपने फोन में दूसरा या तीसरा चुनता हूं तो चयनित आइटम "हाइलाइट" "पहला" होता है इसलिए सभी चीजें सही हैं लेकिन समस्या को हल करने वाली समस्या स्वचालित रूप से पहले आइटम पर जाती है, इसलिए कृपया मुझे लोगों की सहायता करें
पहली गतिविधि कोड है:
BottomNavigationView mBottomNavigation;
mBottomNavigation =(BottomNavigationView) findViewById(R.id.BottomNavigator);
mBottomNavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()){
case R.id.Nav_Second:
Intent Second= new Intent(First.this, Second.class);
startActivity(Second);
break;
case R.id.Nav_Third:
Intent Third= new Intent(First.this, Third.class);
startActivity(Third);
break;
}
return true;
}
});
}}
दूसरी गतिविधि है:
BottomNavigationView mBottomNavigation;
mBottomNavigation =(BottomNavigationView) findViewById(R.id.BottomNavigator);
mBottomNavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()){
case R.id.Nav_First:
Intent First= new Intent(Second.this, First.class);
startActivity(First);
break;
case R.id.Nav_Third:
Intent Third= new Intent(Second.this, Third.class);
startActivity(Third);
break;
}
return true;
}
});
}}
तीसरी गतिविधि है:
BottomNavigationView mBottomNavigation;
mBottomNavigation =(BottomNavigationView) findViewById(R.id.BottomNavigator);
mBottomNavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()){
case R.id.Nav_First:
Intent First= new Intent(Third.this, First.class);
startActivity(First);
break;
case R.id.Nav_Second:
Intent Second= new Intent(Third.this, Second.class);
startActivity(Second);
break;
}
return true;
}
});
}}
एक्सएमएल 3 गतिविधियों के लिए ही कर रहे हैं:
<android.support.design.widget.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/BottomNavigator"
android:background="@color/colorPrimaryDark"
android:layout_alignParentBottom="true"
app:itemTextColor="@drawable/item_bg"
app:itemIconTint="@drawable/item_bg"
app:menu="@menu/navigate_items">
</android.support.design.widget.BottomNavigationView>
समाधान की आवश्यकता है कि जब मैं अपने आप प्रेस आइटम को हाइलाइट करने के लिए है,
मैं खंड का उपयोग किया है और यह पूरी तरह से काम करता है लेकिन मैं अभी भी खंड का उपयोग करने के लिए शुरुआती हूं इसलिए मैं सक्रियण का उपयोग कर रहा हूं एँ ...
किसी भी तेजी से मदद कर रहा
जब तक मैं कुछ याद कर रहा हूँ, इस टुकड़े (और यह पूरी तरह से काम करता है) का उपयोग करने के लिए एक अच्छा परिदृश्य है, तो क्यों कि से टिक नहीं? –
क्योंकि मुख्य गतिविधियों की तुलना में टुकड़ा थोड़ा मुश्किल है ... – 7uthaifah
मैं ऐप कॉम्पैक्ट एक्टिविटी – 7uthaifah