First declare the application scenario: the requirement for the style of the pop-up window is set to rounded corners. For example, the
style of the pop-up window is rounded corners, but the way I made it looks like this, etc.
I obviously didn’t set the background for him. Why is there a corner outside the rounded corners? A black pointy corner? If you want to slide up to make the pop-up window disappear, it will be more obvious when you drag the pop-up window. The effect is as follows. If you look at it like this, the
black background will be exposed. I tried to set the background and switched a variety of styles but failed to remove the background. At the same time I also tested putting the touch event on the parent layout. I wanted to remove the background by moving the parent layout, but the results failed to achieve the desired effect. Then I read the blog to get the result - just set the background of the layout resource is
Dialog mDialog = new Dialog(mContext, R.style.dialog) {
@Override
public void show() {
super.show();
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
UIUtils.hideBottomUIMenu((Activity) mContext);
}
}
};
LayoutInflater inflater = LayoutInflater.from(mContext);
View view = inflater.inflate(R.layout.pop_notification, null);
//设置背景为透明
mDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
mDialog.setContentView(view);
That's it. That's all there is to it, baa baa baa.