android 仿微信朋友圈图片选择控件
调用方式(布局文件就是一个自定义控件):
private ArrayList<String> selectedImages; @BindView(R.id.imagePicker)
ImagePicker imagePicker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_9);
ButterKnife.bind(this);
} @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
imagePicker.setOnActivityResult(requestCode, resultCode, data);
selectedImages = imagePicker.getSelectedPicture();
}
0.AndroidManifest.xml
<activity android:name=".SelectPictureActivity"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
1.自定义控件和布局
package de.bvb.rxdemo.widget; import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView; import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType; import java.util.ArrayList; import de.bvb.rxdemo.R;
import de.bvb.rxdemo.SelectPictureActivity; import static android.app.Activity.RESULT_OK; /**
* http://blog.csdn.net/u013059863/article/details/49708317
*/ public class ImagePicker extends GridView { /** 最多可以选择的图片数量 */
public static final int MAX_SELECTION = 9; private static final int REQUEST_PICK = 0;
private Activity activity;
private GridAdapter gridAdapter; public ImagePicker(Context activity) {
this(activity, null);
} public ImagePicker(Context activity, AttributeSet attrs) {
this(activity, attrs, 0);
} public ImagePicker(Context activity, AttributeSet attrs, int defStyleAttr) {
super(activity, attrs, defStyleAttr);
this.activity = (Activity) activity;
this.setHorizontalSpacing(20);
this.setVerticalSpacing(20);
this.setNumColumns(3);
this.setSelector(new ColorDrawable(0x00000000)); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(activity)
.threadPriority(Thread.NORM_PRIORITY - 2)//设置当前线程的优先级
.denyCacheImageMultipleSizesInMemory()
.diskCacheFileNameGenerator(new Md5FileNameGenerator())//使用MD5对UIL进行加密命名
.diskCacheSize(100 * 1024 * 1024)//50 Mb sd卡(本地)缓存的最大值
.diskCacheFileCount(300)// 可以缓存的文件数量
.tasksProcessingOrder(QueueProcessingType.LIFO)//后进先出
.build(); //初始化操作
ImageLoader.getInstance().init(config); gridAdapter = new GridAdapter();
setAdapter(gridAdapter);
} //存放所有选择的照片
private ArrayList<String> allSelectedPicture = new ArrayList<String>();
// //存放从选择界面选择的照片
// private ArrayList<String> selectedPicture = new ArrayList<String>(); /** 获取选择的图片 */
public ArrayList<String> getSelectedPicture() {
return allSelectedPicture;
} /** 需要覆盖被调用的Activity的 OnActivityResult方法 */
public void setOnActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
ArrayList<String> selectedPicture = (ArrayList) data.getSerializableExtra(SelectPictureActivity.INTENT_SELECTED_PICTURE);
for (String str : selectedPicture) {
if (!allSelectedPicture.contains(str)) {
allSelectedPicture.add(str);
setAdapter(gridAdapter);
}
}
}
} /** 展示图片的GridView的适配器 */
class GridAdapter extends BaseAdapter { public LayoutInflater layoutInflater = LayoutInflater.from(activity); @Override
public int getCount() {
return allSelectedPicture.size() + 1;
} @Override
public Object getItem(int position) {
return position;
} @Override
public long getItemId(int position) {
return position;
} @Override
public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = layoutInflater.inflate(R.layout.childgrid_item, null); holder.image = (ImageView) convertView.findViewById(R.id.child_iv);
holder.btn = (Button) convertView.findViewById(R.id.child_delete); holder.image.setScaleType(ImageView.ScaleType.CENTER_CROP); convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
} if (position == allSelectedPicture.size()) {
holder.image.setImageBitmap(BitmapFactory.decodeResource(
activity.getResources(), R.drawable.icon_addpic));
holder.btn.setVisibility(View.GONE); holder.image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectClick();
}
});
if (position == MAX_SELECTION) {
holder.image.setVisibility(View.GONE);
}
} else {
ImageLoader.getInstance().displayImage("file://" + allSelectedPicture.get(position),
holder.image); holder.btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//点击后移除图片
allSelectedPicture.remove(position);
//更新UI
setAdapter(gridAdapter);
}
}); }
return convertView;
} class ViewHolder {
public ImageView image;
public Button btn;
}
} private void selectClick() {
Intent intent = new Intent();
intent.setClass(activity, SelectPictureActivity.class); Bundle bundle = new Bundle();
bundle.putStringArrayList("allSelectedPicture", allSelectedPicture);
intent.putExtras(bundle); if (allSelectedPicture.size() < MAX_SELECTION) {
activity.startActivityForResult(intent, REQUEST_PICK);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="120dp"
android:layout_height="120dp" > <ImageView
android:id="@+id/child_iv"
android:layout_width="120dp"
android:layout_height="120dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_launcher" /> <Button
android:id="@+id/child_delete"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentRight="true"
android:layout_margin="4dp"
android:background="@drawable/ic_delete" /> </RelativeLayout>
2.选择图片页面 SelectPictureActivity.java
package de.bvb.rxdemo; import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.TranslateAnimation;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast; import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.ImageScaleType; import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List; public class SelectPictureActivity extends Activity { // 最多选择图片的个数
private static int MAX_NUM = 9;
private static final int TAKE_PICTURE = 520; public static final String INTENT_MAX_NUM = "intent_max_num";
public static final String INTENT_SELECTED_PICTURE = "intent_selected_picture"; private Context context;
private GridView gridview;
private PictureAdapter adapter; /**
* 临时的辅助类,用于防止同一个文件夹的多次扫描
*/
private HashMap<String, Integer> tmpDir = new HashMap<String, Integer>();
private ArrayList<ImageFloder> mDirPaths = new ArrayList<ImageFloder>(); /**
* 具体下载图片,缓存图片,显示图片的具体执行类,它有两个具体的方法displayImage(...)、loadImage(...),
*/
private ImageLoader loader; /**
* 用于指导每一个Imageloader根据网络图片的状态(空白、下载错误、正在下载)显示对应的图片,
* 是否将缓存加载到磁盘上,下载完后对图片进行怎么样的处理。
*/
private DisplayImageOptions options; private ContentResolver mContentResolver; //选择按钮和完成按钮
private Button btn_select, btn_ok; //图片文件的列表
private ListView listview; private FolderAdapter folderAdapter; private ImageFloder imageAll, currentImageFolder; //已选择的图片
private ArrayList<String> selectedPicture = new ArrayList<String>(); private String cameraPath = null; private int isExisted; private ArrayList<String> existedPictureList = new ArrayList<String>(); @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_select_picture); MAX_NUM = getIntent().getIntExtra(INTENT_MAX_NUM, 9); Bundle bundle = getIntent().getExtras();
existedPictureList = bundle.getStringArrayList("allSelectedPicture");
isExisted = existedPictureList.size(); context = this;
mContentResolver = getContentResolver();
loader = ImageLoader.getInstance(); options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.ic_launcher)//设置图片在下载期间显示的图片 .showImageForEmptyUri(R.drawable.ic_launcher)//设置图片Uri为空或是错误的时候显示的图片 .showImageOnFail(R.drawable.ic_launcher)//设置图片加载/解码过程中错误时候显示的图片 .cacheInMemory(true)//设置下载的图片是否缓存在内存中 .cacheOnDisk(true) //设置下载的图片是否缓存在SD卡中 .considerExifParams(true)//启用EXIF和JPEG图像格式 .imageScaleType(ImageScaleType.EXACTLY)//图像将完全按比例缩小的目标大小 .bitmapConfig(Bitmap.Config.RGB_565)//设置图片的解码类型 .build(); initView();
} /**
* 点击"所有图片"按钮事件
*
* @param v
*/
public void select(View v) {
if (listview.getVisibility() == View.VISIBLE) {
hideListAnimation();
} else {
listview.setVisibility(View.VISIBLE);
showListAnimation();
folderAdapter.notifyDataSetChanged();
}
} /**
* 设置ListView的移动的动画效果
*/
public void showListAnimation() {
TranslateAnimation ta = new TranslateAnimation(1, 0f, 1, 0f, 1, 1f, 1, 0f);
ta.setDuration(200);
listview.startAnimation(ta);
} /**
* 隐藏ListView的移动的动画效果
*/
public void hideListAnimation() {
TranslateAnimation ta = new TranslateAnimation(1, 0f, 1, 0f, 1, 0f, 1, 1f);
ta.setDuration(200);
listview.startAnimation(ta);
ta.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
} @Override
public void onAnimationRepeat(Animation animation) {
} @Override
public void onAnimationEnd(Animation animation) {
listview.setVisibility(View.INVISIBLE);
}
});
} /**
* 点击完成按钮
*/
public void ok(View v) {
Intent data = new Intent();
data.putExtra(INTENT_SELECTED_PICTURE, selectedPicture);
setResult(RESULT_OK, data);
this.finish();
} /**
* 视图初始化
*/
private void initView() {
imageAll = new ImageFloder();
imageAll.setDir(getResources().getString(R.string.dir_all_pictures));
currentImageFolder = imageAll;
mDirPaths.add(imageAll); btn_ok = (Button) findViewById(R.id.btn_ok);
btn_ok.setText(getResources().getString(R.string.complete) + isExisted + "/" + MAX_NUM); btn_select = (Button) findViewById(R.id.btn_select); gridview = (GridView) findViewById(R.id.gridview);
adapter = new PictureAdapter();
gridview.setAdapter(adapter); gridview.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) {
goCamare();
}
}
}); listview = (ListView) findViewById(R.id.listview);
folderAdapter = new FolderAdapter();
listview.setAdapter(folderAdapter);
listview.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
currentImageFolder = mDirPaths.get(position);
hideListAnimation();
adapter.notifyDataSetChanged();
btn_select.setText(currentImageFolder.getName());
}
});
getThumbnail();
} /**
* 使用相机拍照
*/
protected void goCamare() {
if (isExisted + selectedPicture.size() + 1 > MAX_NUM) {
Toast.makeText(context, getResources().getString(R.string.chose_at_most) + MAX_NUM + getResources().getString(R.string.sheet), Toast.LENGTH_SHORT).show();
return;
} Intent openCameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Uri imageUri = getOutputMediaFileUri();
openCameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(openCameraIntent, TAKE_PICTURE);
} /**
* 用于拍照时获取输出的Uri
*/
protected Uri getOutputMediaFileUri() {
File mediaStorageDir = new File(
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "Night");
if (!mediaStorageDir.exists()) {
if (!mediaStorageDir.mkdirs()) {
Log.d("MyCameraApp", "failed to create directory");
return null;
}
} String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
File mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_" + timeStamp + ".jpg");
cameraPath = mediaFile.getAbsolutePath();
return Uri.fromFile(mediaFile);
} @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && cameraPath != null) { selectedPicture.add(cameraPath); Intent data2 = new Intent();
data2.putExtra(INTENT_SELECTED_PICTURE, selectedPicture); setResult(RESULT_OK, data2);
this.finish();
}
} public void back(View v) {
onBackPressed();
} class PictureAdapter extends BaseAdapter {
@Override
public int getCount() {
return currentImageFolder.images.size() + 1;
} @Override
public Object getItem(int position) {
return null;
} @Override
public long getItemId(int position) {
return 0;
} @Override
public View getView(int position, View convertView, ViewGroup parent) { //自定义的一个类用来缓存convertview
ViewHolder holder = null; if (convertView == null) {
convertView = View.inflate(context, R.layout.grid_item_picture, null);
holder = new ViewHolder();
holder.iv = (ImageView) convertView.findViewById(R.id.iv);
holder.checkBox = (Button) convertView.findViewById(R.id.check);
convertView.setTag(holder); } else {
holder = (ViewHolder) convertView.getTag();
} if (position == 0) {//拍摄图片
holder.iv.setImageResource(R.drawable.pickphotos_to_camera_normal);
holder.checkBox.setVisibility(View.INVISIBLE);
} else {
position = position - 1;
holder.checkBox.setVisibility(View.VISIBLE); final ImageItem item = currentImageFolder.images.get(position); //显示图片
loader.displayImage("file://" + item.path, holder.iv, options); //是否选中
boolean isSelected = (selectedPicture.contains(item.path) || existedPictureList.contains(item.path));
holder.checkBox.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { //若选中的图片多于所设置的上限,不再加入
if (!v.isSelected() && isExisted + selectedPicture.size() + 1 > MAX_NUM) {
Toast.makeText(context, getResources().getString(R.string.chose_at_most) + MAX_NUM + getResources().getString(R.string.sheet), Toast.LENGTH_SHORT).show();
return;
} //二次选择,移除
if (selectedPicture.contains(item.path) || existedPictureList.contains(item.path)) {
selectedPicture.remove(item.path);
} else {
//加入数组
selectedPicture.add(item.path);
} btn_ok.setEnabled(selectedPicture.size() > 0);
btn_ok.setText(getResources().getString(R.string.complete) + (selectedPicture.size() + isExisted) + "/" + MAX_NUM); v.setSelected(selectedPicture.contains(item.path) || existedPictureList.contains(item.path));
}
}); holder.checkBox.setSelected(isSelected);
} return convertView;
}
} //自定义的一个类用来缓存convertview
class ViewHolder {
ImageView iv;
Button checkBox;
} /**
* 所有图片
*/
class FolderAdapter extends BaseAdapter { @Override
public int getCount() {
return mDirPaths.size();
} @Override
public Object getItem(int position) {
return null;
} @Override
public long getItemId(int position) {
return 0;
} @Override
public View getView(int position, View convertView, ViewGroup parent) {
FolderViewHolder holder = null;
if (convertView == null) {
convertView = View.inflate(context, R.layout.list_dir_item, null);
holder = new FolderViewHolder();
holder.id_dir_item_image = (ImageView) convertView.findViewById(R.id.id_dir_item_image);
holder.id_dir_item_name = (TextView) convertView.findViewById(R.id.id_dir_item_name);
holder.id_dir_item_count = (TextView) convertView.findViewById(R.id.id_dir_item_count);
holder.choose = (ImageView) convertView.findViewById(R.id.choose);
convertView.setTag(holder);
} else {
holder = (FolderViewHolder) convertView.getTag();
}
ImageFloder item = mDirPaths.get(position);
loader.displayImage("file://" + item.getFirstImagePath(), holder.id_dir_item_image, options);
holder.id_dir_item_count.setText(item.images.size() + getResources().getString(R.string.sheet));
holder.id_dir_item_name.setText(item.getName()); holder.choose.setVisibility(currentImageFolder == item ? View.VISIBLE : View.GONE);
return convertView;
}
} //自定义的一个类用来缓存convertview
class FolderViewHolder {
ImageView id_dir_item_image;
ImageView choose;
TextView id_dir_item_name;
TextView id_dir_item_count;
} /**
* 获取缩略图
*/
private void getThumbnail() {
Cursor mCursor = mContentResolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[]{MediaStore.Images.ImageColumns.DATA}, "", null,
MediaStore.MediaColumns.DATE_ADDED + " DESC"); if (mCursor.moveToFirst()) {
int _date = mCursor.getColumnIndex(MediaStore.Images.Media.DATA);
do { // 获取图片的路径
String path = mCursor.getString(_date);
imageAll.images.add(new ImageItem(path)); // 获取该图片的父路径名
File parentFile = new File(path).getParentFile();
if (parentFile == null) {
continue;
} ImageFloder imageFloder = null;
String dirPath = parentFile.getAbsolutePath(); if (!tmpDir.containsKey(dirPath)) {
// 初始化imageFloder
imageFloder = new ImageFloder();
imageFloder.setDir(dirPath);
imageFloder.setFirstImagePath(path);
mDirPaths.add(imageFloder);
tmpDir.put(dirPath, mDirPaths.indexOf(imageFloder));
} else {
imageFloder = mDirPaths.get(tmpDir.get(dirPath));
} imageFloder.images.add(new ImageItem(path));
} while (mCursor.moveToNext());
} mCursor.close(); tmpDir = null;
} class ImageFloder {
/**
* 图片的文件夹路径
*/
private String dir; /**
* 第一张图片的路径
*/
private String firstImagePath;
/**
* 文件夹的名称
*/
private String name; public List<ImageItem> images = new ArrayList<ImageItem>(); public String getDir() {
return dir;
} public void setDir(String dir) {
this.dir = dir;
int lastIndexOf = this.dir.lastIndexOf("/");
this.name = this.dir.substring(lastIndexOf);
} public String getFirstImagePath() {
return firstImagePath;
} public void setFirstImagePath(String firstImagePath) {
this.firstImagePath = firstImagePath;
} public String getName() {
return name;
} } class ImageItem {
String path; public ImageItem(String p) {
this.path = p;
}
} }
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <RelativeLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#c000" > <Button
android:id="@+id/btn_back"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_margin="8dp"
android:background="@drawable/ic_back_light"
android:onClick="back" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_toRightOf="@+id/btn_back"
android:text="图片"
android:textColor="#ffffff"
android:textSize="16sp" /> <Button
android:id="@+id/btn_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="8dp"
android:background="@null"
android:gravity="center"
android:onClick="ok"
android:text="完成"
android:textColor="#fff"
android:textSize="14sp" />
</RelativeLayout> <RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#d000" > <GridView
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottom"
android:horizontalSpacing="3dp"
android:numColumns="3"
android:scrollbars="none"
android:verticalSpacing="5dp" >
</GridView> <RelativeLayout
android:id="@+id/bottom"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignParentBottom="true"
android:background="#c000" > <Button
android:id="@+id/btn_select"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_margin="8dp"
android:background="@drawable/spinner_bg"
android:onClick="select"
android:text="所有图片"
android:textColor="#fff"
android:textSize="14sp" /> </RelativeLayout> <ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="360dp"
android:layout_above="@id/bottom"
android:background="#fff"
android:visibility="gone" >
</ListView>
</RelativeLayout> </LinearLayout>
from http://blog.csdn.net/u013059863/article/details/49708317
android 仿微信朋友圈图片选择控件的更多相关文章
- Android仿微信朋友圈图片查看器
转载请注明出处:http://blog.csdn.net/allen315410/article/details/40264551 看博文之前,希望大家先打开自己的微信点到朋友圈中去,细致观察是不是发 ...
- Android仿微信朋友圈图片浏览器(支持图片手势缩放,拖动)
※效果 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbGluZ2xvbmd4aW4yNA==/font/5a6L5L2T/fontsize/400/fil ...
- Android 仿微信朋友圈添加图片
github地址(欢迎下载Demo) https://github.com/zhouxu88/WXCircleAddPic 老习惯,先上图,着急用的朋友,直接带走Demo,先拿来用吧,毕竟老板催的紧, ...
- Android 仿微信朋友圈发动态功能(相册图片多选)
代码分享 代码名称: 仿微信朋友圈发动态功能(相册图片多选) 代码描述: 仿微信朋友圈发动态功能(相册图片多选) 代码托管地址: http://www.apkbus.com/android-15276 ...
- 用c/c++混合编程方式为ios/android实现一个自绘日期选择控件(一)
本文为原创,如有转载,请注明出处:http://www.cnblogs.com/jackybu 前言 章节: 1.需求描述以及c/c++实现日期和月历的基本操作 2.ios实现自绘日期选择控件 3.a ...
- Android 仿微信朋友圈发表图片拖拽和删除功能
朋友圈实现原理 我们使用 Android Device Monitor 来分析朋友圈发布图片的界面实现原理.如果需要分析其他应用的界面实现也是采用这种方法哦. 打开 Android Device Mo ...
- 仿微信朋友圈图片查看-glide加载网络图片,photoview 实现缩放
http://www.cnblogs.com/csonezp/p/5083286.html 这里实现的效果就和微信朋友圈点击图片后查看大图一样,如果你不清楚是什么效果,可以拿出手机,打开朋友圈,找到一 ...
- Android仿微信朋友圈,全文收起功能,附源码
在众多的社交类软件中,朋友圈是必不可少的,可以与好友.同学等分享自己的日常和有意思的事情,在开发社交类App时,朋友圈发表的内容你不可能让他全部显示,全部显示的话用户体验度会非常不好,这时就要用到全文 ...
- Android 仿微信朋友圈拍小视频上传到服务器
这个接上一个写的实现拍小视频和传到服务器的 界面是这个样子滴. 我也知不知道怎么给图片搞小一点o(╯□╰)o 布局文件是这样的[认真脸] <?xml version="1.0&quo ...
随机推荐
- Publish site through visual studio
https://www.c-sharpcorner.com/UploadFile/4b0136/getting-started-with-iis-host-and-publish-in-mvc-5/ ...
- Interacted Action-Driven Visual Tracking Algorithm
文章来源:Attentional Action-Driven Deep Network for Visual Object Tracking 博士论文(2017年8月份完稿) http://s-s ...
- redis配置注意事项(适合于较大配置)
根据官方的建议,redis-server的相关配置建议如下,但是有些并不合适,LZ会进行说明(如果redis使用的内存还不到1GB,或者大量qps还不到1000的应用,这已经淘汰了99%的应用,很多配 ...
- 【React自制全家桶】一、Webstrom+React+Ant Design+echarts搭建react项目
前言 一.React是Facebook推出的一个前端框架,之前被用于著名的社交媒体Instagram中,后来由于取得了不错的反响,于是Facebook决定将其开源.出身名门的React也不负众望,成功 ...
- pytorch常用损失函数
损失函数的基本用法: criterion = LossCriterion() #构造函数有自己的参数 loss = criterion(x, y) #调用标准时也有参数 得到的loss结果已经对min ...
- 浅谈Delphi高效使用TreeView
本来我一直都是使用递归算法, 效率很低 下边这段代码是我原来写的 ------------------------------------------------------------------- ...
- Python 练习题总结(待续)
1.编写一个函数,接受一个参数n,n为正整数,左右两种打印方 式.要求数字必须对齐 正三角 倒三角 实现思路: 思路1.一行一行打印,前面追加空格,每一个空格的宽度等于数字字符串的宽度 #正三角打印d ...
- 页面被iframe与无刷新更换url方法
页面被iframe问题解决方法 if (window.top.location !== window.self.location) { const data = JSON.stringify({ if ...
- weblogic12.1.3安装
weblogic weblogic12.1.3安装 环境: centos7.5 ip: 192.168.0.94 1.安装jdk 2.安装 weblogic 下载.解压安装包 wls1213_dev. ...
- LODOP获取打印状态码和时间列表
之前有博文介绍获取打印状态码和打印状态码的含义,相关博文:LODOP获取打印机状态码和状态码含义测试.此外 ,也有获取状态码及其变化的方法,可以获取打印状态码的列表,列表包含每个状态和每个状态的时间. ...