【问题标题】:SupportMapFragment shows black screen for some milli secondsSupportMapFragment 显示黑屏几毫秒
【发布时间】:2013-06-13 15:43:28
【问题描述】:

我正在做一个项目,我想在片段活动中显示地图片段,这就是我使用以下内容的原因,

public class VenueMapFragment extends SupportMapFragment implements OnClickListener {
private LatLng mPosFija;
private String title;
private BMSActionBar action_bar;

public VenueMapFragment() {
    super();
}


public static VenueMapFragment newInstance(LatLng posicion,String title){
    VenueMapFragment frag = new VenueMapFragment();
    frag.mPosFija = posicion;
    frag.title = title;
    return frag;
}

View layout;
@Override
public View onCreateView(LayoutInflater arg0, ViewGroup arg1, Bundle arg2) {
    layout = super.onCreateView(arg0, arg1, arg2);
    layout.setVisibility(View.GONE);
    initMap();
    return layout;
}

private void initMap(){
    UiSettings settings = getMap().getUiSettings();
    settings.setMyLocationButtonEnabled(true);
    settings.setZoomControlsEnabled(false);
    getMap().animateCamera(CameraUpdateFactory.newLatLngZoom(mPosFija,16),1000,null);
    getMap().addMarker(new MarkerOptions().position(mPosFija).title(title).visible(true));
}

@Override
public void onClick(View v) {

}}

当我从一个片段移动到另一个地图时,会在几毫秒后显示黑屏,然后它工作正常,当我按回时它也显示相同。 真的很丑。

请帮我解决这个问题。

【问题讨论】:

  • 开发你找到解决方案了吗

标签: android android-mapview google-maps-android-api-2


【解决方案1】:

这是 v2 的一个已知问题,同时在此处查看一些可能的解决方法

https://code.google.com/p/gmaps-api-issues/issues/detail?id=4639

https://code.google.com/p/gmaps-api-issues/issues/detail?id=4659

【讨论】:

    【解决方案2】:

    如果它是一个已知问题,你真的无能为力。但这是你可以做的事情。你正在做的处理可以移动到异步任务。直到显示地图时,图像或logo可以在后台闪烁。

    【讨论】:

      【解决方案3】:

      看看这是否有效:-

      NiceSupportMapFragment

      它消除了问题...

      【讨论】:

      • 没有为我解决问题。
      • 它是一个库,为什么要用它来做这些事情。
      猜你喜欢
      • 1970-01-01
      • 2014-02-26
      • 1970-01-01
      • 1970-01-01
      • 2011-05-10
      • 1970-01-01
      • 2013-03-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多