Currently I have the following style.xml
UPDATED - All relevant styles included
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="actionBarStyle">@style/MyActionBarStyle</item>
<item name="actionDropDownStyle">@style/MyDropDownStyle</item>
</style>
<style name="MyActionBarStyle" parent="Widget.AppCompat.ActionBar.Solid">
<item name="android:actionBarDivider">@null</item>
<item name="background">@drawable/logo</item>
<item name="displayOptions">showHome</item>
</style>
<style name="MyDropDownStyle" parent="Base.Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:paddingLeft">240dp</item>
<item name="android:dropDownHorizontalOffset">240dp</item>
<item name="android:background">@android:color/transparent</item>
</style>
This allows me to set move the DropDown 240dp away from its X axis which works quite good. See Screenshot #1
Screenshot #1
But as a side effect this padding causes a blank "space" on the right side of the popup itself. See screenshot #2
Screenshot #2
How can I set a fixed size of the Popup or ignore the padding being set by DropDown style?
UPDATED
The reason for the paddingLeft is to not overlap with logo (defined as background)
<item name="background">@drawable/logo</item>
UPDATE 2 - Screenshot without dropDownHorizontalOffset style
PS:
dropDownHorizontalOffset
is only used to set the X axis of the Popup matching to match the paddingLeft
A possible workaround is to replace the ActionBar with the new toolbar (android.support.v7.widget.Toolbar) and add a Spinner (DropDown) right inside of it
Code lines have been changed for better illustration and are not tested
main_activity.xml
MainActivity.java
ToolbarSpinnerAdapter.java
The result should look quite simliar to the below image:
PS: In Portrait orientation there might not be enough space for the Spinner