10. Андроид иловасида диалог ойналарини ҳосил қилиш Dialog fragmenti DialogFragment
chaqiramiz. Maxsus belgilash bilan AlertDialog AlertDialog
Download 0.58 Mb. Pdf ko'rish
|
1-10
chaqiramiz.
Maxsus belgilash bilan AlertDialog AlertDialog -ning standart ko'rinishi sizga mos kelmasa, siz o'zingizning belgilashingizni o'ylab topishingiz va uni setView( ) usuli orqali ulashingiz mumkin. // Kotlin fun onCreateDialog(savedInstanceState: Bundle?): Dialog { faoliyatni qaytarish?.let { val quruvchi = AlertDialog.Builder(bu) // Inflater tartibini oling val inflater = requireActivity().layoutInflater; // Shamollatish va dialog oynasi tartibini o'rnatish // Asosiy ko'rinish sifatida nullni o'tkazing, chunki u muloqot oynasi tartibiga kiradi builder.setView(inflater.inflate(R.layout.fragment_custom, null)) // Harakat tugmalarini qo'shish .setPositiveButton(R.string.signin, DialogInterface.OnClickListener { dialog oynasi, id -> // foydalanuvchi tizimga kiring ... }) .setNegativeButton(R.string.cancel, DialogInterface.OnClickListener { dialog oynasi, id -> getDialog().cancel() }) builder.create() } ?: otish IllegalStateException("Faoliyat null bo'lishi mumkin emas") 25 } // Java @Override Public Dialog onCreateDialog (to'plam savedInstanceState) { AlertDialog.Builder quruvchisi = yangi AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); Ko'rish ko'rinishi = inflater.inflate (R.layout.fragment_custom, null); builder.setView (ko'rish); // dam olish kod builder.create(); } Ma'lumotlarni faoliyatga o'tkazish Muloqot oynasidagi tugmachalarni bosish uchun siz ota-ona faoliyatini belgilaydigan kodni yozasiz. paket en.alexanderkimov.testapplication; android.app.AlertDialog import; android.app.Dialogni import qilish; android.content.DialogInterface import; android.os.Bundle import; android.support.v4.app.DialogFragmentni import qilish; umumiy sinf MyDialogFragment DialogFragmentni kengaytiradi { @NonNull @Override Public Dialog onCreateDialog (to'plam savedInstanceState) { AlertDialog.Builder quruvchisi = yangi AlertDialog.Builder(getActivity()); builder.setMessage ("Siz mushukka million xayriya qilasiz") Download 0.58 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling