App: defaultNavHost="true"


d viewpager bo’lishi uchun shularning bari bo’lishi va xmlda paddingStart va paddingEnd qancha ko’p bo’lsa shuncha yaxshi ammo kam bo’lsa yaxshi ishlamaydi


Download 80.39 Kb.
bet2/4
Sana24.03.2023
Hajmi80.39 Kb.
#1290736
1   2   3   4
Bog'liq
My Lessons

3d viewpager bo’lishi uchun shularning bari bo’lishi va xmlda paddingStart va paddingEnd qancha ko’p bo’lsa shuncha yaxshi ammo kam bo’lsa yaxshi ishlamaydi.

registerReceiver(networkReceiver, IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"))



receiverga internetni tekshirish uchun shuni activityga yozib qo’yish kerak.
IntentFilter ichiga shuni "android.net.conn.CONNECTIVITY_CHANGE")) yozish kerak.
Android.net.conn.CONNECTIVITY_CHANGE

<attr format="color" name="MyColor"/>
Huddi shu tartibda color value yoki yangi value resource file ochib shu tartibda attr va uning formati belgianadi va nomi.
<item name="MyColor">@color/blackitem>

Shundan so’ng themeda uni ishlatish mumkin dark mode uchun juda qulay.
Shuningdek fontFamily uchun format string bo’lishi mumkin yoki boshqa formatlar uchun ham.
var colors = ArrayList<String>()

colors.add("#B9F6CA")
colors.add("#FF8A80")
colors.add("#80D8FF")
colors.add("#B388FF")

colors.shuffle()

holder.itemView.frame.setBackgroundColor(Color.parseColor(colors[0]))

colorni string qilib olish uchun Color.parseColor() shu funksiya ishlatiladi.
Misol uchun Color.parseColor(“#f00000”).
ArrayListda bo’lsa shu tartibda bo’ladi.

holder.itemView.logo.backgroundTintList = ColorStateList.valueOf(Color.parseColor(data[position].background))


holder.itemView.mode.backgroundTintList = ColorStateList.valueOf(Color.parseColor(data[position].background))
holder.itemView.dialog_btn.backgroundTintList = ColorStateList.valueOf(Color.parseColor(data[position].background))
holder.itemView.tasbex.backgroundTintList = ColorStateList.valueOf(Color.parseColor(data[position].background))


Download 80.39 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




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