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:
<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>
@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:
@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 किया जाता है।
Page Views
0
Visit ID
Not tracked yet
Visit Time
-
Time on Page
0 seconds
Request
Leave a Comment
INITIALIZING...
INITIALIZING...
Quizzes in Hindi
GK Online Quiz in Hindi
10 pages
HTML Online Quiz in Hindi
10 pages
CSS Online Quiz in Hindi
10 pages
JavaScript Online Quiz in Hindi
10 pages
CCC Online Quiz in Hindi
10 pages
Comments Total: 0 comments