java头像选择系统-ag凯发k8国际
【实例简介】
【实例截图】
【核心代码】
头像选择
package com.zhy.utils;
import java.util.list;
import android.content.context;
import android.graphics.drawable.bitmapdrawable;
import android.view.motionevent;
import android.view.view;
import android.view.view.ontouchlistener;
import android.widget.popupwindow;
public abstract class basepopupwindowforlistview extends popupwindow
{
/**
* 布局文件的最外层view
*/
protected view mcontentview;
protected context context;
/**
* listview的数据集
*/
protected list mdatas;
public basepopupwindowforlistview(view contentview, int width, int height,
boolean focusable)
{
this(contentview, width, height, focusable, null);
}
public basepopupwindowforlistview(view contentview, int width, int height,
boolean focusable, list mdatas)
{
this(contentview, width, height, focusable, mdatas, new object[0]);
}
public basepopupwindowforlistview(view contentview, int width, int height,
boolean focusable, list mdatas, object... params)
{
super(contentview, width, height, focusable);
this.mcontentview = contentview;
context = contentview.getcontext();
if (mdatas != null)
this.mdatas = mdatas;
if (params != null && params.length > 0)
{
beforeinitweneedsomeparams(params);
}
setbackgrounddrawable(new bitmapdrawable());
settouchable(true);
setoutsidetouchable(true);
settouchinterceptor(new ontouchlistener()
{
@override
public boolean ontouch(view v, motionevent event)
{
if (event.getaction() == motionevent.action_outside)
{
dismiss();
return true;
}
return false;
}
});
initviews();
initevents();
init();
}
protected abstract void beforeinitweneedsomeparams(object... params);
public abstract void initviews();
public abstract void initevents();
public abstract void init();
public view findviewbyid(int id)
{
return mcontentview.findviewbyid(id);
}
protected static int dptopx(context context, int dp)
{
return (int) (context.getresources().getdisplaymetrics().density * dp 0.5f);
}
}
总结
以上是ag凯发k8国际为你收集整理的java头像选择系统_android 超高仿微信图片选择器(头像选择)的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: c# html 后台拼_c#编写html
- 下一篇: