Search code examples
android-studioandroid-layoutkotlinandroid-actionbar

getSupportActionBar().setElevation(0); - Kotlin? - Remove Shadow from ActionBar


I want to remove the shadow below my action bar. The java code for that is getSupportActionBar().setElevation(0); the kotlin code should be supportActionBar?.setElevation(0) That's what I tried but AndroidStudio is giving me the following error: the integer literal does not conform to the expected type float

I hope somebody can help me to fix that problem.

Regards, Jeremy


Solution

  • do supportActionBar?.setElevation(0f) and because it's Kotlin, you can drop the set

    supportActionBar?.elevation = 0f