這篇文章主要為大家展示了“Android如何實(shí)現(xiàn)仿日歷翻頁、仿htc時(shí)鐘翻頁、數(shù)字翻頁切換效果”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“Android如何實(shí)現(xiàn)仿日歷翻頁、仿htc時(shí)鐘翻頁、數(shù)字翻頁切換效果”這篇文章吧。
效果圖:
自定義控件找自網(wǎng)絡(luò),使用相對(duì)簡單,具體還沒有來得及深入研究,只是先用笨方法大概實(shí)現(xiàn)了想要的效果,后續(xù)有空會(huì)仔細(xì)研究再更新文章,
本demo切換方法是用的笨方法,也就是由新數(shù)字和舊數(shù)字相比較來切換數(shù)字變換的,大致使用方法如下:
//獲取輸入框中的數(shù)字 int newNumber = Integer.parseInt(etInput.getText().toString()); //獲取個(gè)、十、百位數(shù)字 int nbai = newNumber / 100; int nshi = newNumber % 100 / 10; int nge = newNumber % 10; //獲取上次數(shù)字的個(gè)、十、百位數(shù)字 int obai = oldNumber / 100; int oshi = oldNumber % 100 / 10; int oge = oldNumber % 10; //把當(dāng)前的數(shù)字記錄下來 oldNumber = newNumber; //獲取新數(shù)字與舊數(shù)字的個(gè)、十、百相差的數(shù)字 int bai = nbai + 10 - obai; int shi = nshi + 10 - oshi; int ge = nge + 10 - oge; //如果值大于9,就減去10 if(bai > 9){ bai = bai - 10; } if(shi > 9){ shi = shi - 10; } if(ge > 9){ ge = ge - 10; } //把需要切換幾次設(shè)置到自定義控件上 bitflip1.smoothFlip(bai, false); bitflip2.smoothFlip(shi, false); bitflip3.smoothFlip(ge, false);
以上是“Android如何實(shí)現(xiàn)仿日歷翻頁、仿htc時(shí)鐘翻頁、數(shù)字翻頁切換效果”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
網(wǎng)站名稱:Android如何實(shí)現(xiàn)仿日歷翻頁、仿htc時(shí)鐘翻頁、數(shù)字翻頁切換效果-創(chuàng)新互聯(lián)
文章網(wǎng)址:http://aaarwkj.com/article12/dsjigc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、網(wǎng)站收錄、營銷型網(wǎng)站建設(shè)、品牌網(wǎng)站設(shè)計(jì)、外貿(mào)建站、手機(jī)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容