3

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

  • “设置为壁纸”选项
  • 导航按钮(左 - 右)

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

我有关于 HTML5 CSS3 和 PHP 的知识(如果有帮助的话):)

有用的帮助将不胜感激。

4

2 回答 2

4

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

1) PhotoGalleryLive 壁纸
2) Gallery 壁纸
3) Android-wallpaper-slideshow

于 2013-03-04T07:15:29.377 回答
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;
        }

    }
}
于 2013-03-04T07:16:40.993 回答