8

I have implemented pip for my app.

I note that in the Picture-in-picture support documentation it is suggested that

android:configChanges=
    "screenSize|smallestScreenSize|screenLayout|orientation"

is added to the manifest. This has the unwanted effect of preventing the activity lifecycle firing when the app goes into pip mode. and I want the activity - and therefore the layout - to be recreated.

Simple, I just don't use that line.

So now my activity is created and the layout inflated. Only Android is now inflating <layout>-small.xml. Now this is a better option than inflating the 'normal' layout but it's still far too too big a layout for pip mode. (small screens - at least 426dp x 320dp as stated in the documentation - pip is MUCH smaller than that.

So my question is - is there an, as yet, undocumented layout configuration qualifier for pip size layouts, or do I have to tweak my small layout to make sure everything sits in the middle and so can be seen (not a very satisfactory solution).


EDIT

There is a qualifier -pip i.e. <layout>-pip.xml, which I found by accident, that compiles without the error "invalid resource directory name". Good times.

BUT Android still inflates the -small layout when going into pip mode. Bad times


UPDATE

I have ended up implementing this by creating additional reduced layouts which I load in onCreateafter checking isInPictureInPictureMode(). It's not my ideal solution but until I have a better one it is what it is.

Simon Hutton
  • 1,677
  • 3
  • 22
  • 35

0 Answers0