bạn có thể làm điều đó bằng cách sử dụng GIF hình ảnh cũng có, nhưng trước tiên chuyển đổi đó GIF để khung
trong xml
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/img1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/img1"
android:layout_centerHorizontal="true"
android:layout_marginTop="156dp"
android:text="submit"
/>
trong java
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView i = (ImageView)findViewById(R.id.img1);
i.setBackgroundResource(R.drawable.gif);
AnimationDrawable pro = (AnimationDrawable)i.getBackground();
pro.start();
}
}
trong drawable tạo file hình ảnh động
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/selected" android:oneshot="false">
<item android:drawable="@drawable/frame0" android:duration="50" />
<item android:drawable="@drawable/frame1" android:duration="50" />
<item android:drawable="@drawable/frame2" android:duration="50" />
<item android:drawable="@drawable/frame3" android:duration="50" />
<item android:drawable="@drawable/frame4" android:duration="50" />
<item android:drawable="@drawable/frame5" android:duration="50" />
<item android:drawable="@drawable/frame6" android:duration="50" />
<item android:drawable="@drawable/frame7" android:duration="50" />
<item android:drawable="@drawable/frame8" android:duration="50" />
<item android:drawable="@drawable/frame8" android:duration="50" />
<item android:drawable="@drawable/frame9" android:duration="50" />
<item android:drawable="@drawable/frame10" android:duration="50" />
</animation-list>
Hy vọng điều này có thể giúp bạn
Liệu nó giúp bạn? http://mobile.tutsplus.com/tutorials/android/creating-live-wallpapers-on-android/ – RobinHood
Cảm ơn nhưng bài nói chuyện này về cách tạo giấy dán tường. Tôi quan tâm hơn đến cách những hình nền động này được thực hiện ngay từ đầu. Vẽ của chúng tôi một con chim lập trình? Hoặc sử dụng hình ảnh hoặc sử dụng GIF hoặc có thể là một công cụ vẽ đặc biệt? – Snake
Bạn định kế hoạch clip của mình trong bao lâu? Và nó có phải là toàn màn hình hay chỉ là một phần của nó hoạt hình? – pumpkee