第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

用ObjectorAnimator實(shí)現(xiàn)的,但點(diǎn)擊實(shí)現(xiàn)子view的動(dòng)畫效果消失后,再點(diǎn)擊主Button就不能顯示了

設(shè)置了點(diǎn)擊子view后的setAlpha和Visibility都不行,怎么點(diǎn)主button都不能在顯示子view了,請教是怎么回事:

case R.id.id_imgb://點(diǎn)擊子view,讓其放大消失,其它view縮小消失

setSelected(arg0.getId());

//讓被點(diǎn)擊的view放大消失,其它view縮小消失

private void setSelected(int viewId)

{

ObjectAnimator animator;

ObjectAnimator animator1;

for (int i = 1; i < childs.size(); i++)

{

if ((childs.get(i)).getId() == viewId)

{

animator = ObjectAnimator.ofFloat(childs.get(i), View.SCALE_X,

1.0f, 3.0f).setDuration(300);

animator1 = ObjectAnimator.ofFloat(childs.get(i), View.SCALE_Y,

1.0f, 3.0f).setDuration(300);

} else

{

animator = ObjectAnimator.ofFloat(childs.get(i), View.SCALE_X,

1.0f, 0).setDuration(300);

animator1 = ObjectAnimator.ofFloat(childs.get(i), View.SCALE_Y,

1.0f, 0).setDuration(300);

}

ObjectAnimator animator2 = ObjectAnimator.ofFloat(childs.get(i),

View.ALPHA, 1.0f, 0).setDuration(300);

AnimatorSet set = new AnimatorSet();

set.playTogether(animator, animator1, animator2);

set.start();


正在回答

1 回答

ObjectAnimator是屬性動(dòng)畫,執(zhí)行完后是什么樣,它以后就是什么樣了,所以當(dāng)你動(dòng)畫執(zhí)行結(jié)束后,所有的子view透明度都為0,大小為3倍或者0倍,正確的做法是,打開時(shí),將所有子view的樣式和位置都重置(放回原來的位置,透明度置為1,大小為1倍)。

這個(gè)控件不應(yīng)該用ObjectAnimator做,建議敲代碼之前考慮好用哪種方法實(shí)現(xiàn)最合理

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
Android實(shí)現(xiàn)衛(wèi)星菜單
  • 參與學(xué)習(xí)       26324    人
  • 解答問題       59    個(gè)

學(xué)習(xí)仿Path的衛(wèi)星式菜單,課程涵蓋了自定義控件的整個(gè)過程

進(jìn)入課程

用ObjectorAnimator實(shí)現(xiàn)的,但點(diǎn)擊實(shí)現(xiàn)子view的動(dòng)畫效果消失后,再點(diǎn)擊主Button就不能顯示了

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)