Laboratoriya ishi №16 Mavzu: Voqealar (intents)


Download 444.29 Kb.
Pdf ko'rish
bet5/15
Sana14.12.2022
Hajmi444.29 Kb.
#1004913
1   2   3   4   5   6   7   8   9   ...   15
Bog'liq
Abduraximov Elbek 612 19 guruh, 4 deadline

 

xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
tools:context=".MainActivity"> 
 

android:id="@+id/firstFragment" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:background="@color/button_background_color" 
android:text="First Fragment" 
android:textColor="@color/white" 
android:textSize="20sp" /> 
 

android:id="@+id/secondFragment" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_marginTop="10dp" 
android:background="@color/button_background_color" 
android:text="Second Fragment" 
android:textColor="@color/white" 
android:textSize="20sp" /> 
 



android:id="@+id/frameLayout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:layout_marginTop="10dp" /> 
 
Ushbu bosqichda biz MainActivity-ni ochamiz va tugmani ishga tushirish uchun 
kodni qo'shamiz. Shundan so'ng biz ikkala tugmachada setOnClickListener 
hodisasini bajaramiz. Birinchi tugmani bosish bilan biz Birinchi Fragmentni 
almashtiramiz va Ikkinchi Tugmachani bosish bilan Ikkinchi Fragmentni layout 
(FrameLayout) bilan almashtiramiz. Fragmentni FrameLayout bilan almashtirish 
uchun biz birinchi navbatda Fragment menejerini yaratamiz va keyin Fragment 
Transaction yordamida tranzaktsiyani boshlaymiz va nihoyat Fragmentni maket
ya'ni FrameLayout bilan almashtiramiz. 
package com.abhiandroid.fragmentexample; 

Download 444.29 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   15




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling