Android ArcGis 地图图层切换

if (layerlist.contains(local)){
    Log.e("set1","包含遥感影像图层");
    setting_bt2.setBackground(getResources().getDrawable(R.color.setting_bt_color));
    setting_bt2.setTextColor(getResources().getColor(R.color.setting_txt_color));

}else{
    Log.e("set1","不包含遥感影像图层");
    setting_bt2.setBackground(getResources().getDrawable(R.color.setting_txt_color));
    setting_bt2.setTextColor(getResources().getColor(R.color.setting_bt_color));
}
if (layerlist.contains(local1)){
    Log.e("set1","包含地图图层");
    setting_bt1.setBackground(getResources().getDrawable(R.color.setting_bt_color));
    setting_bt1.setTextColor(getResources().getColor(R.color.setting_txt_color));
}else{
    Log.e("set1","不包含地图图层");
    setting_bt1.setBackground(getResources().getDrawable(R.color.setting_txt_color));
    setting_bt1.setTextColor(getResources().getColor(R.color.setting_bt_color));
}
setting_bt1.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        if (layerlist.contains(local1)){
            setting_bt1.setBackground(getResources().getDrawable(R.color.setting_txt_color));
            setting_bt1.setTextColor(getResources().getColor(R.color.setting_bt_color));
            mMapView.removeLayer(local1);
            layerlist.remove(local1);
            Log.e("layerlist","layerlist is :"+layerlist);

        }else{
            setting_bt1.setBackground(getResources().getDrawable(R.color.setting_bt_color));
            setting_bt1.setTextColor(getResources().getColor(R.color.setting_txt_color));
            mMapView.addLayer(local1);
            layerlist.add(local1);
        }
    }
});
setting_bt2.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        if (layerlist.contains(local)){
            setting_bt2.setBackground(getResources().getDrawable(R.color.setting_txt_color));
            setting_bt2.setTextColor(getResources().getColor(R.color.setting_bt_color));
            mMapView.removeLayer(local);
            layerlist.remove(local);
        }else{
            setting_bt2.setBackground(getResources().getDrawable(R.color.setting_bt_color));
            setting_bt2.setTextColor(getResources().getColor(R.color.setting_txt_color));
            mMapView.addLayer(local);
            layerlist.add(local);

        }
    }
});

你可能感兴趣的:(arcgis,for,android)