> For the complete documentation index, see [llms.txt](https://docs.mapbox.com/android/ja/maps/llms.txt)

# Show and hide layers

![Allow the user to toggle the visibility of a CircleLayer on a map.](https://docs.mapbox.com/android/ja/assets/ideal-img/maps-examples-show-and-hide-layers.6902036.480.png)

This example demonstrates how to show and hide layers with a toggle with the **Mapbox Maps SDK for Android**.

The code below renders a layer containing a dataset of museums represented by circles. The layer's visibility can then be toggled with a button, referenced as the `fabLayerToggle`. On the [`setOnClickListener`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.plugin.attribution/-attribution-view/set-view-on-click-listener.html) event for the `fabLayerToggle`, the function grabs the style and then the layer from the style, were the visibility of the layer is toggled using [`layer.visibility`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.extension.style.layers/-layer/visibility.html).

> **Note: Android Examples App Available**
> 
> This example code is part of the **Maps SDK for Android Examples App**, a working Android project [available on GitHub](https://github.com/mapbox/mapbox-maps-android/tree/v11.29.0/). Android developers are encouraged to run the examples app locally to interact with this example in an emulator and explore other features of the Maps SDK.
> 
> See our [Run the Maps SDK for Android Examples App](https://docs.mapbox.com/help/tutorials/maps-sdk-android-examples-app/) tutorial for step-by-step instructions.

**Kotlin**

Title: `ShowHideLayersActivity.kt`

[View on GitHub](https://github.com/mapbox/mapbox-maps-android/blob/v11.29.0/app/src/main/java/com/mapbox/maps/testapp/examples/ShowHideLayersActivity.kt)

```kt
package com.mapbox.maps.testapp.examples

import android.graphics.Color
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.mapbox.bindgen.Value
import com.mapbox.maps.Style
import com.mapbox.maps.extension.style.layers.generated.circleLayer
import com.mapbox.maps.extension.style.layers.getLayer
import com.mapbox.maps.extension.style.layers.properties.generated.Visibility
import com.mapbox.maps.extension.style.sources.generated.vectorSource
import com.mapbox.maps.extension.style.style
import com.mapbox.maps.testapp.databinding.ActivityShowHideLayersBinding

/**
 * Allow the user to toggle the visibility of a CircleLayer on a map.
 */
class ShowHideLayersActivity : AppCompatActivity() {

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    val binding = ActivityShowHideLayersBinding.inflate(layoutInflater)
    setContentView(binding.root)
    binding.mapView.mapboxMap.loadStyle(
      style(Style.STANDARD) {
        +vectorSource(SOURCE_ID) {
          url(SOURCE_URL)
        }
        +circleLayer(LAYER_ID, SOURCE_ID) {
          sourceLayer(SOURCE_LAYER)
          visibility(Visibility.VISIBLE)
          circleRadius(8.0)
          circleColor(Color.argb(255, 55, 148, 179))
        }
      }
    ) {
      binding.mapView.mapboxMap.setStyleImportConfigProperty("basemap", "theme", Value.valueOf("monochrome"))
    }
    binding.fabLayerToggle.setOnClickListener {
      binding.mapView.mapboxMap.getStyle {
        it.getLayer(LAYER_ID)?.let { layer ->
          if (layer.visibility == Visibility.VISIBLE) {
            layer.visibility(Visibility.NONE)
          } else {
            layer.visibility(Visibility.VISIBLE)
          }
        }
      }
    }
  }

  companion object {
    private const val SOURCE_ID = "museums_source"
    private const val SOURCE_URL = "mapbox://mapbox.2opop9hr"
    private const val SOURCE_LAYER = "museum-cusco"
    private const val LAYER_ID = "museums"
  }
}
```