Android appcompat toolbar stretches when searchview gets focus

前端 未结 10 1738
猫巷女王i
猫巷女王i 2020-12-08 08:08

I\'m updating an app to use the new Toolbar instead of the regular ActionBar. In my app the user must be able to select a contact from their contac

10条回答
  •  萌比男神i
    2020-12-08 08:45

    I had the same problem than OP, I tried the android:fitsSystemWindows="true" solution, but it was half resolved: the searchview didn't expand anymore but the notification bar (top of screen) became totally white (like the layout background) instead of red (my app theme).

    I found an alternative way and it's working like a charm, so for those who are stuck, try this:

    In your manifest, just add this line in your activity section:

    android:windowSoftInputMode="adjustPan"

    Example:

    
    
    

提交回复
热议问题