【问题标题】:Android app displaying a gif显示 gif 的 Android 应用
【发布时间】:2013-06-14 08:11:18
【问题描述】:

Display Animated GIF

我正在阅读上面的链接和其他一些链接,但我无法让我的工作。我希望它只在视图或类似的东西中运行 gif 图像,或者将其拆分为帧并扔掉每一帧。是否有视频或其他内容,或者有人可以在那里发布 xml、java 文件和他们使用的图片。我需要一个非常详细的教程。

这里也可以给用户发消息吗?


这是java类(FrenchSilk)

import android.app.Activity;
import android.os.Bundle;
import android.view.SurfaceView;

public class FrenchSilk extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.frenchsilk);

        SurfaceView v = (SurfaceView) findViewById(R.id.surfaceView1);
        GifRun w = new GifRun();
        w.LoadGiff(v, this, R.drawable.rotating_planet);

    }
}

这是 XML 类 (frenchsilk)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:ignore="HardcodedText" >

<!--    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center"
    android:text="Words"
    android:textSize="25dp" />  
-->


<SurfaceView
    android:id="@+id/surfaceView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />


</LinearLayout>

我在 Drawable-hdpi 文件夹中有一个名为 rotation_planet 的 gif 文件

我正在关注那个 youtube 视频,但我不知道 GifRun 课程中应该有什么,或者是否有其他方式来显示动画 gif。

【问题讨论】:

  • 如果您发布到目前为止您尝试过的代码以及出了什么问题,您可能会得到更好的回应。
  • youtube.com/watch?v=uRI4PuxDuqg 还有我在这里发布的问题顶部的链接
  • 您可以使用android.graphics.Movie 来显示GIF 动画,this example 使用它来制作Nyan-cat 动态壁纸。
  • 我试过这样做。没用。我想显示 XML 文件状态的 gif 图像的帧。就像它说 图片 200 毫秒> 然后转到下一种类型的东西。

标签: android eclipse gif


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-12-08
    • 2014-02-21
    • 2013-08-22
    • 2016-08-24
    • 2016-11-05
    • 2012-03-20
    • 2023-03-03
    相关资源
    最近更新 更多