标签: android-gallery

android圆形图库?

我是android开发的新手.现在我想将图库视图像下面的图像那样圆形.事情是我想在用户从左到右和从右到左滚动时放大中心图像.那有什么教程吗?

在此输入图像描述 我想要的是被刷过的图像需要在它的中心放大.我以为我可以用画廊来做.但Android开发人员的例子不是我想要的.:(

android android-gallery android-image

5
推荐指数
2
解决办法
9164
查看次数

android画廊视图"口吃"与延迟图像加载适配器

我想创建一个与Gallery小部件一起使用的延迟加载适配器.

也就是说立即getView()返回一个ImageView,后来其他一些机制会异步调用它的setImageBitmap()方法.我通过创建一个ImageView延伸的"懒惰" 来做到这一点ImageView.

public class GalleryImageView extends ImageView {

    // ... other stuff here ...

    public void setImage(final Looper looper, final int position) {

    final Uri uri = looper.get(position);
    final String path = looper.sharePath(position);

    new Thread(new Runnable() {

        @Override
        public void run() {
            GalleryBitmap gbmp = new GalleryBitmap(context, uri, path);
            final Bitmap bmp = gbmp.getBitmap(); // all the work is here
            handler.post(new Runnable() {

                @Override
                public void run() …
Run Code Online (Sandbox Code Playgroud)

android android-gallery android-adapter

5
推荐指数
2
解决办法
2880
查看次数

如何在Android中增加图像视图的大小

我正在开发一个项目,要求我实现两个水平滚动视图,在它们之间有一个图像视图.我想扩展图像视图的大小以填补滚动视图之间的空白.我浏览了示例代码,但它似乎没有提到图像视图的大小.在描述我的问题的图像之后,我附上了下面的代码.

在此输入图像描述

public class Gallery2DemoActivity extends Activity {
private Gallery gallery,gallery1;
private ImageView imgView;

private Integer[] Imgid = {
    R.drawable.a_1, R.drawable.a_2, R.drawable.a_3, R.drawable.a_4, R.drawable.a_5, R.drawable.a_6, R.drawable.a_7
};

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

gallery = (Gallery) findViewById(R.id.examplegallery);
gallery.setAdapter(new AddImgAdp(this));

gallery1 = (Gallery)findViewById(R.id.examplegallery1);
gallery1.setAdapter(new AddImgAdp(this));

imgView = (ImageView)findViewById(R.id.ImageView01);    
imgView.setImageResource(Imgid[0]);


 gallery.setOnItemClickListener(new OnItemClickListener() {
    public void onItemClick(AdapterView parent, View v, int position, long id) {
        imgView.setImageResource(Imgid[position]); 
    }
});

}

public class AddImgAdp extends BaseAdapter { …
Run Code Online (Sandbox Code Playgroud)

java android galleryview android-gallery android-xml

5
推荐指数
1
解决办法
1万
查看次数

getRealPathFromURI()不使用基于ICS和Picasa的图像

我正在尝试获取图像的本地路径,以便将其上传到服务器.当使用pre ICS时,它将通过Android设备获得标准路径getRealPathFromURI(theURI)

但是,ICS URI将包含uriString如下内容:content://com.google.android.gallery3d.provider/picasa/item/12312312312312.

并运行getRealPathFromURI(theURI)返回null

我现在需要提取以上内容uriString并通过API手动下载图像(如果我检测到它是Picasa图库图像)而不是本地存储的图像吗?还是我完全错过了什么?

谢谢你的建议

编辑:

好像我在寻找错误的问题......

在下面的链接中发现了这个问题......这正是我所期望的,我需要做的事情.相当恼人的谷歌/ android没有更优雅地处理这个.

要正确处理从图库中提取图像,您需要处理三种情况:

  1. 用户选择了本地图像文件

  2. 用户选择了Picasa图像,设备正在运行3.0之前的Android版本

  3. 用户选择了Picasa图片,设备正在运行Android 3.0及更高版本

http://dimitar.me/how-to-get-picasa-images-using-the-image-picker-on-android-devices-running-any-os-version/

android picasa android-gallery

5
推荐指数
1
解决办法
8780
查看次数

CoverFlow扩展了Gallery(已弃用在> 4.0设备中无法正常工作)

我正在使用这个类在我的应用程序中实现CoverFlow:

public class CoverFlow extends Gallery {

/**
 * Graphics Camera used for transforming the matrix of ImageViews
 */
private Camera mCamera = new Camera();

/**
 * The maximum angle the Child ImageView will be rotated by
 */    
private int mMaxRotationAngle = 60;

/**
 * The maximum zoom on the centre Child
 */
private int mMaxZoom = -175;

/**
 * The Centre of the Coverflow 
 */   
private int mCoveflowCenter;



public CoverFlow(Context context) {
  super(context);
  this.setStaticTransformationsEnabled(true);
 }

 public CoverFlow(Context context, AttributeSet …
Run Code Online (Sandbox Code Playgroud)

android android-gallery

5
推荐指数
1
解决办法
1330
查看次数

在onActivityResult方法中从库中接收多个图像

我想在我的应用程序的onActivity Result方法中从图库中获取多个图像,但我无法为其创建游标.如果我不使用光标,我无法获得所有图像的Uris.如果我必须选择单个图像,代码非常简单:

@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);

 if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) {
     Uri selectedImage = data.getData();
     String[] filePathColumn = { MediaStore.Images.Media.DATA };

     Cursor cursor = getContentResolver().query(selectedImage,
             filePathColumn, null, null, null);
     cursor.moveToFirst();

     int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
     String picturePath = cursor.getString(columnIndex);
     cursor.close();

     // String picturePath contains the path of selected Image
     }
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮助我.

android android-gallery android-listview

5
推荐指数
2
解决办法
2668
查看次数

将gif保存到android库

使用https://github.com/koush/ion image Loader将gif文件显示到ImageView中

我通过此代码将jpg图像保存到图库中

    MediaStore.Images.Media.insertImage(
                                    getActivity().getContentResolver(), bitmap,
                                    "XXX", "Image1"); 
Run Code Online (Sandbox Code Playgroud)

但这种方式不适用于gif文件.

你知道我怎么能做到这一点?

android gif android-gallery android-ion

5
推荐指数
1
解决办法
9966
查看次数

onActivityResult不从viewPager片段调用

嗨我在主片段中使用viewPager和fragmnets.我试图从图库或相机获取图像到位图,但在选择照片和startActivityForResult后它没有捕获onActivityResult ...

这是我如何调用startActivityForResult:

private void setAvatarDialog(){
        final CharSequence[] options = {"Choose from Gallery", "Take Photo" };

        String title = getString(R.string.alertDialog_editProfile_updateAvatar_title);
        String negative = getString(R.string.alertDialog_editProfile_updateAvatar_negative);

        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(title);
        builder.setItems(options, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (options[which].equals(options[0])) {
                    mIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                    mIntent.setType("image/*");
                    startActivityForResult(Intent.createChooser(mIntent, "Select File"), SELECT_FILE);
                } else if (options[which].equals(options[1])) {
                    mIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                    startActivityForResult(mIntent, REQUEST_CAMERA);
                }
                dialog.dismiss();
            }
        });
        builder.setNegativeButton(negative, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int …
Run Code Online (Sandbox Code Playgroud)

android android-gallery android-camera-intent onactivityresult

5
推荐指数
1
解决办法
5307
查看次数

用于访问图库的Android 6运行时权限

我对Android 6(Marshmallow)运行时权限有疑问.如果用户想要从图库中选择照片,我们是否应该请求READ_EXTERNAL_STORAGE许可?

好像我可以访问图库,即使我关闭存储权限.

android-gallery android-external-storage android-6.0-marshmallow runtime-permissions

5
推荐指数
1
解决办法
4135
查看次数

从SD卡或Android中的任何应用程序中选择docx,doc,rtf,pdf类型的文件

目前我正在尝试从SD卡或任何应用程序中选择特定类型的文件,但我失败了,我的代码如下,

Intent intent;
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
            intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
        else
            intent = new Intent(Intent.ACTION_GET_CONTENT);

        intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        intent.setType("application/pdf|application/msword|application/vnd.openxmlformats-officedocument.wordprocessingml.document" +
                "|application/vnd.openxmlformats-officedocument.wordprocessingml.template" +
                "|application/vnd.ms-word.document.macroEnabled.12" +
                "|application/vnd.ms-word.template.macroEnabled.12" +
                "!application/vnd.ms-word.template.macroEnabled.12|application/rtf");

        startActivityForResult(intent, Constants.ImagePicker.REQ_PICK_RESUME);
Run Code Online (Sandbox Code Playgroud)

但它只选择每种类型的文件.

android document android-intent android-gallery android-external-storage

5
推荐指数
1
解决办法
674
查看次数