|
android:orderInCategory="3" android:title="Ilova haqida" />
|
bet | 2/3 | Sana | 25.05.2024 | Hajmi | 1,65 Mb. | | #253821 |
Bog'liq M10 (4) android:orderInCategory="3" android:title="Ilova haqida" /> menu> - elementi quyidagi atributlarni o'z ichiga oladi, bu uning tashqi ko'rinishi va harakatini belgilaydi:
android:id: menyu elementining unikal identifikatori, uni foydalanuvchi tanlaganida aniqlash va id bo'yicha resurs qidiruvi orqali topish imkonini beradi. android:icon: element uchun tasvirni belgilaydigan chizilgan manbaga havola. android:title: element sarlavhasini o'z ichiga olgan string manbasiga havola. Menyuni elementlar bilan to'ldirish Biz uchta elementdan iborat menyuni belgilab oldik, lekin faqat fayldagi elementlarni belgilash menyuni yaratmaydi. Bu shunchaki deklarativ tavsif. Uni ekranda ko'rsatish uchun biz uni Activity klassida ishlatishimiz kerak. Buning uchun, onCreateOptionsMenu metodini qayta aniqlash kerak bo'ladi. activity_main.xml xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content"
|
| |