I am coding an Android game in which 2 players play at the same time. Player 1 faces the phone in a normal way and Player 2 faces it upside down. Each player can change preferences which I want to be accessed through a popup menu which will be anchored to an onscreen Button. Each player will have their own Button.
I have managed to rotate the widgets for Player 2 by adding the following xml tags in the layout resources:
android:rotation="180"
So that part is all well.
My question is, how do I go about making an android.widget.PopupMenu
also appear upside down for Player 2? The effect I am looking for is that Player 2 will get a PopupMenu
which they would be able to read from their angle.
Any help or suggestions on how to best achieve this will be much appreciated.
I solved a similar issue by using
PopupWindow
.PopupWindow
can be constructed with any layout of your choosing, such as one you inflate from xml. That layout can have theandroid:rotation
tags.In my case I used
where
popupContent
is the layout I inflated from xml.PopupWindow docs: http://developer.android.com/reference/android/widget/PopupWindow.html