顯示gif動畫(幀動畫的播放),gif動畫播放

來源:互聯網
上載者:User

顯示gif動畫(幀動畫的播放),gif動畫播放

在android上顯示gif不太方便,雖然有控制項可以實現,但是效果不是很好,保險點兒的作法還是使用幀動畫來處理。
①在XML中定義animation-list:
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false" >

    <item android:drawable="@drawable/f_1" android:duration="30"/>
    <item android:drawable="@drawable/f_2" android:duration="30"/>
    <item android:drawable="@drawable/f_3" android:duration="30"/>
    <item android:drawable="@drawable/f_4" android:duration="30"/>
</animation-list>
②在XML布局中定義ImageView,指定其src屬性或background屬性為"@anim/loading"
③在java代碼中:
ImageView imageView = (ImageView) findViewById(R.id.frame);
AnimationDrawable drawable = (AnimationDrawable) imageView.getDrawable();
// 使用background屬性時
// AnimationDrawable drawable = (AnimationDrawable) imageView.getBackground();
drawable.setOneShot(false); // 重複播放
④在java代碼中調用:
drawable.start()或drawable.stop()實現動畫的播放和停止。


PHOTOSHOP開啟動態圖片時,出現此為GIF動畫,您只可以瀏覽一幀

對 PS本身不支援gif的編輯。 需要相關外掛程式才可以。
你可以嘗試使用FW去編輯gif或者flash去編輯。

回答你1:如果編輯GIF的話建議使用FW(firework)或者flash編輯.
2.如果是PS的話 修改gif圖是不可以使用文字工具的, 可以將GIF圖片切下來建立圖層。 不過這樣就單一變成了圖片。
如果你實在想用PS去編輯GIF 可以去百度搜尋支援編輯GIF的PS外掛程式可以幫到你。
不過說實話PS真不適合做GIF動畫。
 
為何我用PS開啟GIF動畫的時提示說只可以顯示一幀?

你用幾點零的ps開啟gif動畫,它也會提示你只能開啟一幀,因為ps是平面製作工具而並非gif動畫製作工具;
你要想看到全部的gif動畫幀必須用專門的gif動畫製作工具才行,有一點要注意,gif動畫製作時使用的工具不同,如果不用製作時的工具開啟可能開啟後你所看到的效果不是太盡人意。
參考資料:經驗
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.