1

Before marking this as duplicate, I'd like to say that I have gone through SO posts like this, this and this. But I haven't found any solution suitable to me.

I am trying to create a pop-up window using PopupWindow(). I want to design this window using rounded corners and dropback shadows (like shadows under a FloatingActionButton).

I have come across solutions like defining a shape with rounded corners and then using it as a background. But there is this problem with this solution.

This doesn't work. as you've set, it's the background, so the content overrides the rounded corners, and if you have content that draws on the corners, you won't see them being rounded. - (posted here)

I assume this is not an ideal solution. There was also another solution of creating a Custom Layout class as provided on the second link. But using that I faced a few problems like my EditText within this layout was not updating it's text inside while typing. It is being updated once I close the keyboard. Moreover, this solution also has some performance issues.

There was no real helpful SO posts on designing a pop-up window in android. I'd like to know if there are standard ways to do this effectively and if that is even possible.

For shadow effects, I saw this post, and tried the different solutions it offered. But they gave me very different results across devices. I would also like to know if there is a possible standard and effective solution.

Please help. Thank you.

Community
  • 1
  • 1
Sajib Acharya
  • 1,448
  • 3
  • 28
  • 49

2 Answers2

1

create a 9 patch background like so:

enter image description here

content padding will not let it spread outside corners.

  • create a 9 patch image with rounded corners, use it as background of outer layout, all the content will fit inside without overlapin the round corners. –  Nov 14 '15 at 17:44
0

To make a rounded corner pop up, define the parent layout with the background color that matches base color of the current activity. Then define a child layout with all parameters same as the parent layout.Then set the background with a resource file defining the shape properties for rounded corners.