解决方案 »
- 请教高手们一个难题!!!!!!!!!
- 在 android 上实现 自己的 flash player 方案
- 如何辨别该流量是WIFI产生还是GPS产生呀?
- wallpaperManager.setBitmap
- android 开机第一次不锁屏怎么设置啊!?
- android opengl程序同样的顶点坐标及纹理坐标,同样大小的bmp与png纹理,png显示正常但bmp左右对角交换了。
- 通过action启动server问题
- 请教一个语句如何理解?
- 短信自动删除。。懂的进
- AndroidStudio中SQLite数据库的创建
- 如何让定时器不失效
- android 自带浏览iframe中onclick事件触发 问题
@TargetApi(Build.VERSION_CODES.CUPCAKE)
@SuppressLint("NewApi")
public PopupWindows(Context mContext, View parent) { super(mContext); View view = View.inflate(mContext,
R.layout.zhgl_userinfo_avatarupdate, null);
view.startAnimation(AnimationUtils.loadAnimation(mContext,
R.anim.fade_ins));
LinearLayout ll_popup = (LinearLayout) view
.findViewById(R.id.ll_popup);
ll_popup.startAnimation(AnimationUtils.loadAnimation(mContext,
R.anim.push_bottom_in_2)); setWidth(LayoutParams.FILL_PARENT);
setHeight(LayoutParams.FILL_PARENT);
setBackgroundDrawable(new BitmapDrawable());
setFocusable(true);
setOutsideTouchable(true);
setContentView(view);
showAtLocation(parent, Gravity.BOTTOM, 0, 0);
update(); Button bt1 = (Button) view
.findViewById(R.id.item_popupwindows_camera);
Button bt2 = (Button) view
.findViewById(R.id.item_popupwindows_Photo);
Button bt3 = (Button) view
.findViewById(R.id.item_popupwindows_cancel);
bt1.setOnClickListener(new OnClickListener() {
// 通过相机获得图片
public void onClick(View v) {
Intent intentFromCapture = new Intent(
MediaStore.ACTION_IMAGE_CAPTURE);
intentFromCapture.putExtra(
MediaStore.EXTRA_OUTPUT,
Uri.fromFile(new File(Environment
.getExternalStorageDirectory(), "head2.png"))); // intentFromCapture.putExtra(MediaStore.EXTRA_VIDEO_QUALITY,
// 1);
startActivityForResult(intentFromCapture,
CAMERA_REQUEST_CODE);
dismiss();
}
});
bt2.setOnClickListener(new OnClickListener() {
// 从本地选取图片
public void onClick(View v) {
Intent intentFromGallery = new Intent();
intentFromGallery.setType("image/*"); // 设置文件类型
intentFromGallery.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intentFromGallery,
IMAGE_REQUEST_CODE);
dismiss();
}
});
bt3.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
dismiss();
}
}); }
}
然后在activity里 new PopupWindows(UserInfoActivity.this, aiv);