外围大学生靠谱的借款appapp;还要学什么,比较难的

气泡响应鼠标单击事件解决方法 - C++当前位置:& &&&气泡响应鼠标单击事件解决方法气泡响应鼠标单击事件解决方法&&网友分享于:&&浏览:82次气泡响应鼠标单击事件我用Shell_NotifyIcon函数弹出了一个气泡,现在需要点击这个气泡来弹出一个网页,请大侠指教气泡怎么响应鼠标单击消息呢?谢谢------解决方案--------------------
//可随便取一个用户消息id值&
&//产生icon&
NOTIFYICONDATA
NotifyIconD&
NotifyIconData-& cbSize
sizeof(NOTIFYICONDATA);&
&NotifyIconData-& hWnd
&NotifyIconData-& uID
&NotifyIconData-& uFlags
NIF_MESSAGE
//点击icon时对应的消息id&
&NotifyIconData-& uCallbackMessage
UM_NOTIFY;&
&NotifyIconData-& hIcon
LoadIcon(hInst,(LPCTSTR)IDI_HIDEWINDOW);&
&sprintf(pNotifyIconData-& szTip, &HideWindow
&NotifyIconData-& uVersion
NOTIFYICON_VERSION;&
&Shell_NotifyIcon(NIM_ADD,pNotifyIconData);&
&Shell_NotifyIcon(NIM_SETVERSION,pNotifyIconData);&
&//处理UM_NOTIFY消息&
UM_NOTIFY:&
&switch(lParam)&
WM_CONTEXTMENU:
//右键单击&
&DisplayContextMenu(hWnd);&
&//显示菜单&
DisplayContextMenu(HWND
hmenuTrackP
nMouse[3]={0};&
&//pt.x=100;
pt.y=100;&
&GetCursorPos(&pt);&
LoadMenu(hInst,
(LPCTSTR)IDC_HIDEWINDOW))
hmenuTrackPopup
GetSubMenu(hmenu,
SetForegroundWindow(hwnd);&
TrackPopupMenu(hmenuTrackPopup,
TPM_LEFTALIGN
TPM_RIGHTBUTTON,
&PostMessage(hwnd,WM_NULL,0,0);&
DestroyMenu(hmenu);
&} LZ参考:/Articles/74/Adding-Icons-to-the-System-Trayhttp://topic.csdn.net/t//1331897.html
12345678910
12345678910
12345678910 上一篇:下一篇:文章评论相关解决方案 12345678910 Copyright & &&版权所有6879人阅读
android(16)
//继承MyLocationOverlay重写dispatchTap实现点击处理
public class locationOverlay extends MyLocationOverlay{
public locationOverlay(MapView mapView) {
super(mapView);
// TODO Auto-generated constructor stub
protected boolean dispatchTap() {
// TODO Auto-generated method stub
//处理点击事件,弹出泡泡
popupText.setBackgroundResource(R.drawable.popup);
popupText.setText(&我的位置&);
* 把一个xml布局文件转化成view
public View getView(String title, String text) {
View view = getLayoutInflater().inflate(R.layout.marker, null);
TextView text_title = (TextView) view.findViewById(R.id.marker_title);
TextView text_text = (TextView) view.findViewById(R.id.marker_text);
SpannableString titleText = new SpannableString(temLocation.getCity());
titleText.setSpan(new ForegroundColorSpan(Color.RED), 0,
titleText.length(), 0);
text_title.setText(titleText);
SpannableString texttext = new SpannableString(temLocation.getAddrStr());
texttext.setSpan(new ForegroundColorSpan(Color.BLACK), 0,
texttext.length(), 0);
text_text.setText(texttext);
pop.showPopup(BMapUtil.getBitmapFromView(popupText),
pop.showPopup(BMapUtil.getBitmapFromView(view),
new GeoPoint((int)(locData.latitude*1e6), (int)(locData.longitude*1e6)),
}&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:background=&@drawable/custom_info_bubble&
android:orientation=&vertical& &
android:id=&@+id/marker_title&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content& /&
android:id=&@+id/marker_text&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content& /&
&/LinearLayout&
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:87752次
积分:1078
积分:1078
排名:千里之外
原创:24篇
转载:32篇
评论:11条
(1)(1)(1)(1)(1)(1)(1)(3)(1)(7)(6)(3)(1)(2)(2)(2)(1)(1)(3)(1)(9)(7)&&&&地图点击标注触发不同的事件
地图点击标注触发不同的事件
最近我们一个团队做一个项目,需要个地图周边功能,使用医药吧上的数据
若举报审核通过,可奖励20下载分
被举报人:
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
VIP下载&&免积分60元/年(1200次)
您可能还需要
移动开发下载排行下次自动登录
现在的位置:
& 综合 & 正文
Android 调用高德API,添加浮层,指定范围触发点击事件(添加了自定义的浮层View)
最近做的app中有这个功能,看了阵子API,结合了一下网上一些Demo,自己写了下这种功能如何实现,为自己做个笔记,菜鸟成长ing
哈哈,要养成这个写博客的习惯,大家一起努力
功能: 指定经纬度,添加图片,在图片范围内点击弹出浮层,点击其他地方浮层消失
MyOverlay中myView就是自定义的View
public class MapOfMeetingActivity extends MapActivity implements OnClickListener{private Button btnB// 返回按钮private MapView mapV private PoiOverlay poiO
private MapController mC
private int zoomLevel = 14;
private GeoPprivate MyLocationOverlay mLocationO
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.meetingmap);
mapView = (MapView) findViewById(R.id.mapView); // 得到MapView对象
mapView.setBuiltInZoomControls(true); // 开启缩放控件
mController = mapView.getController(); // 获取地图控制对象
mController.setZoom(zoomLevel); // 设置初始缩放级别
MyLocationOverlay mylocTest = new MyLocationOverlay(MapOfMeetingActivity.this, mapView);
mylocTest.enableMyLocation();
mylocTest.enableCompass(); // 打开指南针
mapView.getOverlays().add(mylocTest);
btnBack = (Button) findViewById(R.id.btnBack);
btnBack.setOnClickListener(this);
GeoPoint gp = new GeoPoint((int) (39.955441 * 1E6),
(int) (116.441807 * 1E6)); // 定位到豪成大厦,左参数为纬度,右参数为经度,单位为微度(1度=10^6微度)
mController.setCenter(gp); // 设置为地图中心
List&Overlay& list = mapView.getOverlays(); // 获取图层列表
MyOverlay demo = new MyOverlay(this, mapView, new PopUpPanel(this, mapView)); // 新建自定义Overlay
list.add(demo); // 往列表添加自定义图层
mLocationOverlay = new MyLocationOverlay(this, mapView);
mapView.getOverlays().add(mLocationOverlay);//实现初次定位使定位结果居中显示
// mLocationOverlay.runOnFirstFix(new Runnable() {
public void run() {
handler.sendMessage(Message.obtain(handler, Constants.FIRST_LOCATION));
class MyOverlay extends Overlay implements OnGestureListener{
TextView mTipT
LinearLayout info_// 地点介绍布局
PopUpPanel mTipP
// 声明一个弹出框对象
MapView mMapV
// 声明一个地图视图对象
GeoPoint mSelectP
// 声明一个地理坐标点对象
GestureDetector gestureS // 声明一个手势监听对象
View myV// 自定义View
int bitmapWidth = 0;// 地图上图标的宽度
int bitmapHeight = 0;// 地图上图片的高度
int drawX = 0;
int drawY = 0;
public MyOverlay(){
public MyOverlay(Context c, MapView mMapView, PopUpPanel panel){
this.mTipPanel =
gestureScanner = new GestureDetector(this);
this.mMapView = mMapV
myView = getLayoutInflater().inflate(R.layout.positioninfo, null);
info_layout = (LinearLayout) myView.findViewById(_layout);
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
Projection proj = mapView.getProjection(); // 获取投影对象
Point mPoint = new Point();
GeoPoint gp = new GeoPoint((int) (39.955441 * 1E6),
(int) (116.441807 * 1E6));
proj.toPixels(gp, mPoint); // 将经纬度转换成手机屏幕上的像素,存储在Point对象中
Paint mPaint = new Paint();
Bitmap pic = BitmapFactory.decodeResource(getResources(),
R.drawable.map_coordinate); // 得到Bitmap对象
bitmapWidth = pic.getWidth();
bitmapHeight = pic.getHeight();
drawX = mPoint.x;
drawY = mPoint.y;
canvas.drawBitmap(pic, drawX, drawY, mPaint); // 绘图
super.draw(canvas, mapView, shadow);
public boolean onDown(MotionEvent e) {}
public void onShowPress(MotionEvent e) {}
public boolean onSingleTapUp(MotionEvent e) {}
public boolean onScroll(MotionEvent e1, MotionEvent e2,float distanceX, float distanceY) {}
/************************* 长按屏幕触发的事件*/public void onLongPress(MotionEvent e) {
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY) {}
/*************************************** 点击屏幕触发的事件*/public boolean onTouchEvent(MotionEvent e, MapView mapView) {int x = (int) e.getX();
int y = (int) e.getY();
mSelectPoint = mapView.getProjection().fromPixels(x, y);
BWLog.d("---------点击屏幕的x,y-------&&" + x +"////" + y);
if (e.getAction() == MotionEvent.ACTION_DOWN){
if (x & drawX && x & drawX+bitmapWidth && y &drawY && y&drawY+bitmapHeight){
Toast.makeText(context, "现在地图的缩放级别是" + mapView.getZoomLevel(), Toast.LENGTH_LONG).show();
showTap(mSelectPoint);
removeTipPanel();
}return gestureScanner.onTouchEvent(e);}
//移走弹出窗口
public void removeTipPanel(){
mMapView.removeView(myView);
}//显示弹出窗口
public boolean showTap(GeoPoint p) {
mMapView.removeView(myView);
//布局参数设置
MapView.LayoutParams geoLP = new MapView.LayoutParams(
MapView.LayoutParams.WRAP_CONTENT,
MapView.LayoutParams.WRAP_CONTENT, p,
MapView.LayoutParams.BOTTOM_CENTER);
//弹出窗口的文本显示
mTipText = (TextView) myView.findViewById(R.id.meetingInfo);
//在地图视图上添加该弹出窗口视图
mMapView.addView(myView, geoLP);
info_layout.setOnClickListener(new OnClickListener() {public void onClick(View v) {Intent intent = new Intent(MapOfMeetingActivity.this, MeetingMapActivity.class);startActivity(intent);}});
public void onClick(View v) {switch(v.getId()){case R.id.btnBack:finish();}}@Overrideprotected void onPause() {
this.mLocationOverlay.disableMyLocation();super.onPause();}
@Overrideprotected void onResume() {this.mLocationOverlay.enableMyLocation();super.onResume();}
功能实现了,其实也不是很懂,所以记录下,注释都是根据自己理解写出来的再就是网上Demo里带的了,有不对的地方希望各位大牛指出来
上个图片看看效果
点击地图上的标记
&&&&推荐文章:
【上篇】【下篇】

我要回帖

更多关于 简网app工场靠谱吗 的文章

 

随机推荐