为Android本地图像创建照片库应用程序

时间:2013-03-04 07:08:51

标签: android gallery photo live-wallpaper android-gallery

我想为Android创建一个具有以下功能的照片库应用程序,

  • “SET AS WALLPAPER”选项
  • 导航按钮(左 - 右)

它更像是一个动态壁纸。 我需要知道是否有任何源代码可以帮助我快速创建。

我对HTML5 CSS3和PHP(如果有帮助)有所了解:))

非常感谢有用的帮助。

2 个答案:

答案 0 :(得分:4)

查看以下动态壁纸的链接:

1)PhotoGalleryLive wallpaper
2)Gallery Wallpaper
3)Android-wallpaper-slideshow

答案 1 :(得分:1)

这是我为我的应用程序进行图像查看的方式......

import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;

public class CertDisplay extends Activity {
    Integer[] pics = {
            R.drawable.cert1,
            R.drawable.cert2,
            R.drawable.cert3,
            R.drawable.cert4,
            R.drawable.cert5
    };
    ImageView imageView;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.certificate);            
        Gallery ga = (Gallery)findViewById(R.id.Gallery01);
        ga.setAdapter(new ImageAdapter(this));
    }

    public class ImageAdapter extends BaseAdapter {

        private Context ctx;
        int imageBackground;

        public ImageAdapter(Context c) {
            ctx = c;
            TypedArray ta = obtainStyledAttributes(R.styleable.Gallery1);
            imageBackground = ta.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 1);
            ta.recycle();
        }

        @Override
        public int getCount() {

            return pics.length;
        }

        @Override
        public Object getItem(int arg0) {

            return arg0;
        }

        @Override
        public long getItemId(int arg0) {

            return arg0;
        }

        @Override
        public View getView(int arg0, View arg1, ViewGroup arg2) {
            ImageView iv = new ImageView(ctx);
            iv.setImageResource(pics[arg0]);
            iv.setScaleType(ImageView.ScaleType.FIT_XY);
            //iv.setLayoutParams(new Gallery.LayoutParams(750,1020));
            iv.setBackgroundResource(imageBackground);
            return iv;
        }

    }
}