Issue
Popup menu on inflate goes out of the screen for this activity, works fine for other
Extending custom AppCompatActivity
Styles:
<style name="AppTheme.ActionBar.TransparentContextTranscition" parent="AppTheme.NoActionBar">
<item name="android:windowActivityTransitions">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:itemBackground">@android:color/white</item>
<item name="android:textColor">@android:color/black</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="android:popupMenuStyle">@style/PopupMenu</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="color">@android:color/white</item>
</style>
<style name="PopupMenu" parent="@android:style/Widget.PopupMenu">
<item name="android:popupBackground">@android:color/white</item>
</style>
Java code
holder.contextMenuView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final PopupMenu popup = new PopupMenu(v.getContext(), v);
popup.inflate(R.menu.song_item_menu_album_inner_layout);
}
});
Toolbar inflate menu works fine
Solution
Looks like I was using
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
my bad. FLAG_LAYOUT_NO_LIMITS, removes limits for the context menu. (That's the reason, the context menu going out of the screen), Hope that helps for someone
Answered By - Saiteja Prasadam
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.