简体   繁体   English

我可以将android应用程序的背景设置为一组图像吗?

[英]Can I make the background of the android application as group of images?

I need help in make the background of my app as gallery of photos... is that possible? 我需要帮助将我的应用程序的背景设置为照片库...这可能吗? and how to do that? 以及如何做到这一点?

You can use a GridView to show images in column and row fashion. 您可以使用GridView以列和行的方式显示图像。 For more information you can take a look at this article for implementing gridview . 有关更多信息,您可以阅读本文以实现gridview

您可以通过为父级布局分配一个id来实现,然后在Java中,您可以在执行某些操作后更改背景图片。

You can use Asyymmetric Gridview to achive attractive view of gallery 您可以使用非对称Gridview来获得画廊的迷人景色

you can use this library 你可以使用这个

Yes You can I did it before by creating an animation that contain the images then I set this animation as backgroud 是的,您可以通过创建包含图像的动画来做到这一点,然后将此动画设置为背景

        // Type casting the Image View
    ImageView view = (ImageView) findViewById(R.id.imageView1);

    // Setting animation_list.xml as the background of the image view
    view.setBackgroundResource(R.anim.animation);

    // Type casting the Animation drawable
    AnimationDrawable frameAnimation = (AnimationDrawable) view.getBackground();
    frameAnimation.start();

example animation xml: 示例动画xml:

    <?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/image_1" android:duration="3000" />
    <item android:drawable="@drawable/image_2" android:duration="3000" />
    <item android:drawable="@drawable/image_3" android:duration="3000" />   

</animation-list>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM