Android popup window not filling screen size?

Here you can’t use layout which is in your popup window xml. You have to use any View from main layout. Right now I am using FloatingButton as a View to showAtLocation. fabButton = (ImageButton) findViewById(R.id.activity_profileView_FAB); fabButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { initiatePopupWindow(v); } }); private void initiatePopupWindow(View v) { try … Read more

Pop up window to display some stuff in a fragment

The following should work perfect in accordance with your specification. Call this method from inside onClick(View v) of OnClickListener assigned to the View: public void showPopup(View anchorView) { View popupView = getLayoutInflater().inflate(R.layout.popup_layout, null); PopupWindow popupWindow = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); // Example: If you have a TextView inside `popup_layout.xml` TextView tv = (TextView) popupView.findViewById(R.id.tv); tv.setText(….); … Read more

Change background popupMenu in Android

the following styles working perfectly for me. <style name=”popupMenuStyle” parent=”Theme.AppCompat.Light.DarkActionBar”> <item name=”android:textColor”>@color/color_white</item> <item name=”android:itemBackground”>@color/color_red</item> </style> here, parent should be the AppTheme parent and in your code use these lines. Context wrapper = new ContextThemeWrapper(context, R.style.popupMenuStyle); PopupMenu popup = new PopupMenu(wrapper, v); i hope it will work.