Welcome to
w3study.github.io
Introduction to Menus and types of menus in hindi
Introduction to Menus
- Menu Android Apps में एक Navigation Component है, जो Users को Options और Actions Select करने की सुविधा देता है।
- Android में मुख्य रूप से तीन प्रकार के Menus होते हैं: Options Menu, Context Menu, और Popup Menu।
- Options Menu Screen के ऊपर दाईं ओर Three-dot Menu के रूप में Show होता है और Primary Actions के लिए Use किया जाता है।
- Context Menu किसी Specific Item (जैसे कि ListView या Text) को Long Press करने पर Open होता है और Item-Specific Actions Provide करता है।
- Popup Menu एक छोटा Floating Menu होता है, जो Button Click करने पर Open होता है और Temporary Options Provide करता है।
- Menu को XML File में Define किया जाता है और onCreateOptionsMenu() Method के द्वारा Activity में Load किया जाता है।
- Menu Items में Icons, Titles, और Submenus Add किए जा सकते हैं, जिससे User Experience और बेहतर हो जाता है।
- Menu में Items को Handle करने के लिए onOptionsItemSelected() Method का उपयोग किया जाता है।
- Menus का उपयोग Settings, Search, Logout, और अन्य Common Actions को Simplify करने के लिए किया जाता है।
- Menus Android Apps को Organized और User-Friendly बनाते हैं, जिससे Navigation आसान हो जाता है।
Types of Menus (Option menu, Context menu) in hindi
1. Options Menu:
- यह Primary Menu होता है, जो Three-Dot (⋮) Icon के रूप में Screen के ऊपर दाईं ओर Show होता है।
- इसमें Settings, Search, Logout जैसी Common Actions होती हैं।
- इसे onCreateOptionsMenu() Method के द्वारा Create किया जाता है।
- XML में इसे Define किया जाता है और Activity में Inflate किया जाता है।
- Example:
XML
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/action_settings"
android:title="Settings"
android:icon="@drawable/ic_settings"
android:showAsAction="always"/>
</menu>
java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
2. Context Menu
- यह Long Press (Click & Hold) करने पर Open होता है और Specific Items (जैसे ListView या ImageView) के लिए होता है।
- इसे registerForContextMenu(View) Method से Register करना पड़ता है।
- इसे onCreateContextMenu() Method में Define किया जाता है।
- Example:
java
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle("Select an Action");
menu.add(0, v.getId(), 0, "Edit");
menu.add(0, v.getId(), 0, "Delete");
}
Options Menu पूरी Screen के लिए होता है, जबकि Context Menu सिर्फ एक Specific Item के लिए Use किया जाता है।
Uses of Shared Preferences
Development of Android Applications Notes in Hindi
Request:
हैलो दोस्तों! उम्मीद करता हूं आपको हमारा यह content/post पसंद आया होगा। अगर आपको हमारा ये content/post पसंद आई हो तो अपने दोस्तों के पास भी share करे। और अगर आपको कोई problem या कोई specific content हिन्दी में चाहिए है तो आप हमें नीचे दिए गए Email या whatsapp number के जरिए बता सकते है।
अगर आप CCC/diploma/polytechnic/MCA/BCA etc कर रहे है तो ये website स्पेशली आपके लिए ही है, जो student हिंदी में पढ़ाई करते है।
Contact Us
Email: deepanshuranjan8057@gmail.com
Whatsapp: +91 8057754706
Follow Us