android 实现实现APP中改变头像图片的实例代码中改变头像图片的实例代码
具体代码如下所示:
package com.example.studyapplication.fragment;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.text.style.ForegroundColorSpan;
import android.text.style.URLSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.studyapplication.MainActivity;
import com.example.studyapplication.R;
import com.example.studyapplication.wode_Activity;
import com.example.studyapplication.zhubanfangActivity;
import com.example.studyapplication.zhuceActivity;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import static android.app.Activity.RESULT_OK;
public class WodeFragment extends Fragment implements View.OnClickListener {
private View mView;
private Context mAvtivity;
Button youhuiquan;
Button shoucang;
Button guanzhu;
ImageView shezhi;
ImageView xiaoxi;
TextView qiehuanweizhuban;
static TextView denglu;
LinearLayout daifukuan;
LinearLayout daicanyu;
LinearLayout tuikuan;
LinearLayout yiwancheng;
LinearLayout qingxiandenglu;
LinearLayout log;
LinearLayout quanbudingdan;
private Button LL01,LL02,LL03;
private Context mContext;
private ImageButton touxiang;
private Bitmap head;// 头像Bitmap
private static String path = "/sdcard/myHead/";// sd路径
Activity mActivity;
Uri uritempFile;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mView = inflater.inflate(R.layout.wode_layout, null);
mActivity=this.getActivity();
//设置布局文件5888
评论0
最新资源