How to remove black background of popups. I am using showAtLocation method to show the popup. I followed this but no use. I tried the following method:
popup.getContentView().setBackgroundResource(android.R.color.transparent);
How to remove black background of popups. I am using showAtLocation method to show the popup. I followed this but no use. I tried the following method:
popup.getContentView().setBackgroundResource(android.R.color.transparent);
You can set background to the root element of your popup layout. To remove the default black background from the popup setBackgroundDrawable(null)
Example:
Background for popup window layout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_rectangle_round"
android:backgroundTint="@color/colorPrimary">
...
In your pop up window class
...
setBackgroundDrawable(null)
...
Just set a background colour in main layout-element of your layout. Transparent is not a very useful colour for a pop-up window.
So i mean set a background in the layout file of the contentView used in: PopupWindow(View contentView, int width, int height, boolean focusable)