我在Android应用中使用Mapbox Android SDK v4.0.0,在某些时候需要在给定位置和给定缩放级别“冻结”MapView。
在我看来,API中没有方法可以:
如何完成这项工作?
答案 0 :(得分:10)
似乎API在版本3.2.0和4.0.0之间发生了变化。目前,要实现上述目标,您需要使用mapboxMap
并将其注入mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
mapboxMap.setCameraPosition(new CameraPosition.Builder()
.target(yourLatLng)
.zoom(yourZoom)
.build());
}
});
:
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
{
View v = convertView;
ExpandListGroup group = (ExpandListGroup) getGroup(groupPosition);
if (v == null)
{
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.my_layout, parent, false);
ViewHolder holder = new ViewHolder();
holder.textview = v.findViewById(R.id.textGroup));
holder.group = group;
v.setTag(holder);
}
ViewHolder holder = (ViewHolder) v.getTag();
// Do whatever you need to with the group view for example:
// groupName = holder.group.getGroupName();
return v;
}
public class ViewHolder
{
TextView textview;
Group group;
public ViewHolder()
{
}
}
像魅力一样。