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))
Do'stlaringiz bilan baham: |