Android Gradient chizilgan rangi o'zgarishi

Chizilgan papkada rasmga olishim mumkin. Mana xml tarkibi:

<?xml version="1.0" encoding="utf-8"?>

    
  

Endi startColor, centerColor, endColorni ish vaqtida java kodidan o'zgartirishni xohlayman. O'zgarish qanday mumkin?

3
Java tasavvuridan foydalaning.
qo'shib qo'ydi muallif Jens, manba

1 javoblar

Afsuski buni amalga oshirish uchun API yo'q. Men kelajakdagi Android versiyasiga qo'shaman.

12
qo'shib qo'ydi
Hech qanday java kodi orqali hech qanday xml ishlatmasdan jami chizilganni qayta yaratish kerakmi?
qo'shib qo'ydi muallif dev_android, manba
o'rnini bosadigan GradientDrawable yaratdim. Lekin qanday qilib uni biron bir shaklga qo'yishim mumkin? Buning uchun ShapeDrawabledan foydalanishi kerakmi? agar shunday bo'lsa, unda men GradientDrawableni ShapeDrawablega qanday qilib sozlay olaman?
qo'shib qo'ydi muallif dev_android, manba
GradientDrawable ShapeDrawable-ning setShaderFactory usuliga mos keladigan biror narsaga ega emas, shuning uchun dan ortiq gradient yaratish uchun foydalanish mumkin. faqat 3 rangda . Hmm. : - /
qo'shib qo'ydi muallif Dr. Wily's Apprentice, manba
Ha, GradientDrawable dan foydalaning.
qo'shib qo'ydi muallif Romain Guy, manba
GradientDrawable ham va uchun almashtiriladi
qo'shib qo'ydi muallif Romain Guy, manba
Buning uchun API 16 .
qo'shib qo'ydi muallif yincrash, manba