统一安卓iOS双端的infowindow和paopaoView,提供易用性,效果更佳的显示效果。
可以单独添加某个UI,比如image、title等;也可组合各种UI。
添加RichView
/*** v7.6.3 新增接口 仅overlay2.0生效* 添加marker上方的ui,可添加多个不同ui* @param richView*/public void addRichView(RichView richView)
销毁
public void removeRichView(RichView richView)
销毁所有地图上的RichView
/*** 销毁所有的RichView,仅Overlay2.0生效*/public void clearRichViews()
设置View
/*** 设置需要展示的View* @param view {#BaseUI}*/public void setView(BaseUI view)
设置锚点(相对marker的位置)
/*** 设置RichView的锚点** @param located {@link # Located}*/public void setLocated(Located located)
设置碰撞方式
/*** 设置RichView的碰撞方式 参考marker的碰撞方法**/public void setCollisionBehavior(CollisionBehavior behavior)
设置可见性
/*** 设置RichView的可见性** @param visibility*/public void setVisibility(int visibility)
设置显示层级
/*** 设置RichView显示层级. [from, to]** @param from : Min_Level 3* @param to : Max_Level 22*/public void setShowLevel(int from, int to)
设置碰撞优先级
/*** 设置RichView的碰撞优先级* 只有在 「CollisionBehavior == HIDE_BY_PRIORITY」才能使用** @param priority** 注意: RichView.priority <= it's parent.priority*/public void setCollisionPriority(short priority)
设置动画
/*** 设置RichView的动画** @param animation {@link # Animation}*/public void setAnimation(Animation animation)
设置缩放比例
/*** 设置RichView的缩放比例** @param scale*/public void setScale(float scale)
添加LabelUI
LabelUI label = new LabelUI();label.setText("我是markerB");label.setMaxLines(2);TextStyle txtStyle = new TextStyle();txtStyle.setTextColor(Color.RED);txtStyle.setTextSize(28);label.setTextStyle(txtStyle);mRichViewB = new RichView();mRichViewB.setView(label);
LabelUI的主要接口
/*** 设置文本内容** @param text 文本*/public void setText(String text)/*** 设置文本样式** @param style 文本样式*/public void setTextStyle(TextStyle style)
ImageUI添加
BitmapDescriptor bitmapDescriptor1 = BitmapDescriptorFactory.fromResource(R.drawable.xhdpi_uber);imageUI.setDrawableResource(bitmapDescriptor1);imageUI.setClickable(true);imageUI.setClickAction("imageUI");mRichViewB = new RichView();mRichViewB.setView(imageUI);
ImageUI的主要接口
/*** 设置背景图片** @param drawableRes 背景图片资源*/public void setDrawableResource(BitmapDescriptor drawableRes)/*** 设置是否可点击** @param isClickable*/public void setClickable(boolean isClickable)/*** 设置背景图片颜色** @param argb 背景图片颜色*/public void setColor(int argb)
HorizontalLayout水平布局添加
HorizontalLayout hhLayout = new HorizontalLayout();hhLayout.setBackgroundColor(Color.RED);hhLayout.setGravity(UIGravity.CENTER_VERTICAL);hhLayout.setClickable(true);hhLayout.setClickAction("hhLayout");// 准备UI// ImageUIImageUI imageUI = new ImageUI();BitmapDescriptor bitmapDescriptor1 = BitmapDescriptorFactory.fromResource(R.drawable.xhdpi_uber);BitmapDescriptor bitmapDescriptor2 = BitmapDescriptorFactory.fromResource(R.drawable.nodpi_titlebg);imageUI.setDrawableResource(bitmapDescriptor1);imageUI.setClickable(true);imageUI.setClickAction("imageUI");// LabelUI1LabelUI labelUI1 = new LabelUI();labelUI1.setGravity(UIGravity.TOP);labelUI1.setText("#BmMarker# 百度地图");labelUI1.setClickable(true);labelUI1.setClickAction("labelUI1");TextStyle textStyle2 = new TextStyle();textStyle2.setTextColor(0xFF2211EE);textStyle2.setTextSize(28);labelUI1.setTextStyle(textStyle2);// LabelUI2LabelUI labelUI2 = new LabelUI();labelUI2.setGravity(UIGravity.BOTTOM);labelUI2.setText("TAG 百度地图");labelUI2.setClickable(true);labelUI2.setClickAction("labelUI2");TextStyle textStyle22 = new TextStyle();textStyle22.setTextColor(0xFFAA2211);textStyle22.setTextSize(22);labelUI2.setTextStyle(textStyle22);// 以水平方式组合各种UIhhLayout.addView(imageUI);hhLayout.addView(labelUI1);hhLayout.addView(labelUI2);mRichViewA = new RichView();mRichViewA.setView(hhLayout);
HorizontalLayout水平布局的主要接口
/*** 添加子UI对象* @param ui*/public void addView(BaseUI ui)/*** 设置相对位置* 只有父容器的宽高大于内部控件宽高,才能体现出gravity 居左 局右 局上 局下,否则父容器默认是自适应的,是子控件把容器充满的,就体现不出gravity* @param gravity*/public void setGravity(UIGravity gravity)/*** 设置是否可点击** @param isClickable*/public void setClickable(boolean isClickable)
混合布局添加
HorizontalLayout hhLayout = new HorizontalLayout();hhLayout.setBackgroundColor(Color.RED);hhLayout.setGravity(UIGravity.CENTER_VERTICAL);hhLayout.setClickable(true);hhLayout.setClickAction("hhLayout");VerticalLayout vvlayout = new VerticalLayout();vvlayout.setClickable(true);vvlayout.setBackgroundColor(Color.GREEN);vvlayout.setClickAction("vvlayout");// ImageUIImageUI imageUI = new ImageUI();BitmapDescriptor bitmapDescriptor1 = BitmapDescriptorFactory.fromResource(R.drawable.xhdpi_uber);BitmapDescriptor bitmapDescriptor2 = BitmapDescriptorFactory.fromResource(R.drawable.nodpi_titlebg);imageUI.setDrawableResource(bitmapDescriptor1);imageUI.setClickable(true);imageUI.setClickAction("imageUI");// LabelUI1LabelUI labelUI1 = new LabelUI();labelUI1.setGravity(UIGravity.TOP);labelUI1.setText("#BmMarker# 百度地图");labelUI1.setClickable(true);labelUI1.setClickAction("labelUI1");TextStyle textStyle2 = new TextStyle();textStyle2.setTextColor(0xFF2211EE);textStyle2.setTextSize(28);labelUI1.setTextStyle(textStyle2);// LabelUI2LabelUI labelUI2 = new LabelUI();labelUI2.setGravity(UIGravity.BOTTOM);labelUI2.setText("TAG 百度地图");labelUI2.setClickable(true);labelUI2.setClickAction("labelUI2");TextStyle textStyle22 = new TextStyle();textStyle22.setTextColor(0xFFAA2211);textStyle22.setTextSize(22);labelUI2.setTextStyle(textStyle22);// 混合布局vvlayout.addView(labelUI2);vvlayout.addView(labelUI1);hhLayout.addView(imageUI);hhLayout.addView(vvlayout);mRichViewA = new RichView();mRichViewA.setView(hhLayout);
上一篇
下一篇
本篇文章对您是否有帮助?