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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

更改圓形顯示動(dòng)畫(huà)的顏色

更改圓形顯示動(dòng)畫(huà)的顏色

滄海一幻覺(jué) 2023-06-08 20:57:58
我向我的 fab 按鈕添加了圓形顯示動(dòng)畫(huà),但我不想將片段顏色更改為不同的顏色,而是想更改動(dòng)畫(huà)的顏色,因?yàn)槲蚁M业南乱粋€(gè)片段是白色背景。我試圖將片段顏色更改為不同于白色并再次變回白色,但它沒(méi)有用。那么有沒(méi)有辦法改變動(dòng)畫(huà)的顏色,而不是片段的顏色?這是我的一些代碼:@Override    public View onCreateView(LayoutInflater inflater, ViewGroup container,                             Bundle savedInstanceState) {        // Inflate the layout for this fragment        final View rootView = inflater.inflate(R.layout.fragment_note_add, container, false);        rootView.addOnLayoutChangeListener(new View.OnLayoutChangeListener(){            @Override            public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom){                rootView.removeOnLayoutChangeListener(this);                rootView.setBackgroundColor(getArguments().getInt("color"));                int cx = getArguments().getInt("cx");                int cy = getArguments().getInt("cy");                int radius = (int) Math.hypot(right, bottom);                Animator reveal = ViewAnimationUtils.createCircularReveal(v, cx, cy, 0, radius);                reveal.setInterpolator(new DecelerateInterpolator(2f));                reveal.start();            }        });        return rootView;    }在這里,我再次嘗試將背景設(shè)為白色。 @Override    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {        //Initialize UI Elements        FloatingActionButton saveButton = view.findViewById(R.id.fab_add);        saveButton.setOnClickListener(saveButtonListener);        editText = view.findViewById(R.id.note_editor);        view.setBackgroundColor(getResources().getColor(R.color.white));        super.onViewCreated(view, savedInstanceState);    }
查看完整描述

1 回答

?
動(dòng)漫人物

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超10個(gè)贊

在這種情況下沒(méi)有“動(dòng)畫(huà)顏色”這樣的東西。Circular Reveal 動(dòng)畫(huà),在引擎蓋下,將圓形裁剪蒙版應(yīng)用于視圖并為裁剪值設(shè)置動(dòng)畫(huà)以在視覺(jué)上表示“顯示”。您看到的顯示顏色是實(shí)際視圖本身。

如果我理解正確,您希望在顯示運(yùn)行時(shí)在您的視圖中進(jìn)行顏色轉(zhuǎn)換。如果是這種情況,請(qǐng)遵循以下步驟:

  • 聲明開(kāi)始和結(jié)束顏色。

  • 將動(dòng)畫(huà)偵聽(tīng)器附加到圓形顯示動(dòng)畫(huà)。

  • 在顯示動(dòng)畫(huà)更新時(shí),使用 ARGBevaluator 使用顯示動(dòng)畫(huà)當(dāng)前進(jìn)度在開(kāi)始和結(jié)束顏色之間進(jìn)行評(píng)估。將此顏色值設(shè)置為視圖的背景。


查看完整回答
反對(duì) 回復(fù) 2023-06-08
  • 1 回答
  • 0 關(guān)注
  • 169 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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