Android 拍摄从画廊拍摄的照片
我有一种方法可以启动图库,这样我就可以选择照片了(这很有效) 作为图像路径 当我尝试加载此图像时Android 拍摄从画廊拍摄的照片,android,Android,我有一种方法可以启动图库,这样我就可以选择照片了(这很有效) 作为图像路径 当我尝试加载此图像时 public class MyPickListener implements Picker.PickListener, View.OnLongClickListener { HorizontalScrollView imageScroll; LinearLayout imageLayout; LinkedList<View> thumbnails = new
public class MyPickListener implements Picker.PickListener, View.OnLongClickListener {
HorizontalScrollView imageScroll;
LinearLayout imageLayout;
LinkedList<View> thumbnails = new LinkedList<>();
LinkedList<String> thumbnailsPaths = new LinkedList<>();
@Override
public void onPickedSuccessfully(final ArrayList<ImageEntry> images) {
imageLayout = (LinearLayout) view.findViewById(R.id.thumbnail_layout);
imageScroll = (HorizontalScrollView) view.findViewById(R.id.thumbnail_scroll);
imageLayout.setHorizontalScrollBarEnabled(false);
for(ImageEntry image : images){
if (imageCount < 5) {
imageCount++;
imageScroll.setVisibility(View.VISIBLE);
View view = viewBuilder.createThumbnail(getActivity(), image.path);
thumbnails.add(view);
thumbnailsPaths.add(image.path);
view.setOnLongClickListener(this);
imageLayout.addView(view);
MainActivity.imageArray.add(image.path);
}
}
}
公共类MyPickListener实现Picker.PickListener、View.OnLongClickListener{
水平滚动查看图像滚动;
线性布局图像布局;
LinkedList缩略图=新建LinkedList();
LinkedList thumbnailsPaths=新建LinkedList();
@凌驾
public void OnPicked成功(最终ArrayList图像){
imageLayout=(LinearLayout)view.findViewById(R.id.thumbnail\u布局);
imageScroll=(HorizontalScrollView)view.findViewById(R.id.thumboil\u scroll);
imageLayout.setHorizontalScrollBarEnabled(false);
用于(图像输入图像:图像){
如果(图像计数<5){
imageCount++;
imageScroll.setVisibility(View.VISIBLE);
视图=viewBuilder.createThumbnail(getActivity(),image.path);
缩略图。添加(视图);
thumbnailspath.add(image.path);
view.setOnLongClickListener(此);
imageLayout.addView(视图);
MainActivity.imageArray.add(image.path);
}
}
}
我的问题是,我需要做什么才能加载从库中拍摄的图像。目前它们只显示为空,谢谢那么,到底什么是
viewBuilder
?
/storage/emulated/0/capture1461208914080.png
public class MyPickListener implements Picker.PickListener, View.OnLongClickListener {
HorizontalScrollView imageScroll;
LinearLayout imageLayout;
LinkedList<View> thumbnails = new LinkedList<>();
LinkedList<String> thumbnailsPaths = new LinkedList<>();
@Override
public void onPickedSuccessfully(final ArrayList<ImageEntry> images) {
imageLayout = (LinearLayout) view.findViewById(R.id.thumbnail_layout);
imageScroll = (HorizontalScrollView) view.findViewById(R.id.thumbnail_scroll);
imageLayout.setHorizontalScrollBarEnabled(false);
for(ImageEntry image : images){
if (imageCount < 5) {
imageCount++;
imageScroll.setVisibility(View.VISIBLE);
View view = viewBuilder.createThumbnail(getActivity(), image.path);
thumbnails.add(view);
thumbnailsPaths.add(image.path);
view.setOnLongClickListener(this);
imageLayout.addView(view);
MainActivity.imageArray.add(image.path);
}
}
}