App: defaultNavHost="true"
Download 80.39 Kb.
|
My Lessons
- Bu sahifa navigatsiya:
- Button_id
<androidx.fragment.app.FragmentContainerView android:id="@+id/fragment_container" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="match_parent" app:navGraph="@navigation/nav_one" app:defaultNavHost="true"/> Bunda app:defaultNavHost="true"/> bo’lmasa onBackPressed()qilinganda appdan chiqib ketadi ya’ni onBackPressed() ishlamaydi shuning uchun true bo’lishi shart. android:name="androidx.navigation.fragment.NavHostFragment" bu shunday bo’lishi kerak bo’lmasa ishlamaydi!!!. android:id="@+id/fragment_container" id berilishi shart bo’lmasa umuman ishlamaydi. Button_id.setOnClickListener { Navigation.findNavController(view).navigate(R.id.action_blankFragment_to_blankFragment2) } Button_id = Button idsi Bu fragment ichiga yoziladi Navigation. findNavController(view).navigate(R.id…bu yerga navgraphda berilgan action bo’lishi kerak) view o’rnida this yoki contextga o’xshagan narsa. binding!!.toolbar.setNavigationOnClickListener { Navigation.findNavController(requireView()).navigateUp() } onBackPressed (ya’ni orqaga qaytish uchun) Fragment navigationda shu ishlatiladi.!!! var window : Window = window window.navigationBarColor = getColor(R.color.blue) navigationBar yoki actionbarni rangini o’zgartirish uchun binding!!.vp2.clipToPadding = false binding!!.vp2.clipChildren = false binding!!.vp2.offscreenPageLimit = 1 binding!!.vp2.adapter = adapter binding!!.vp2.orientation = ViewPager2.ORIENTATION_HORIZONTAL val transformer = CompositePageTransformer() transformer.addTransformer(MarginPageTransformer(8)) binding!!.vp2.setPageTransformer(transformer) <androidx.viewpager2.widget.ViewPager2 android:id="@+id/vp2" android:layout_width="match_parent" android:layout_height="321dp" android:paddingStart="51dp" android:paddingEnd="51dp"/> Download 80.39 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling