Created
January 2, 2018 06:27
-
-
Save nguyenlinhnttu/959a3438b9a5b34e0472fe9ae1f41ee5 to your computer and use it in GitHub Desktop.
Popup tip below view android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] locScreen = new int[2]; | |
btnActionMenu.getLocationOnScreen(locScreen); | |
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); | |
View root = inflater.inflate(R.layout.layout_tip_calendar, null); | |
RelativeLayout rlContent = root.findViewById(R.id.rl_content_tip); | |
GradientDrawable drawable = (GradientDrawable) rlContent.getBackground(); | |
drawable.setStroke(3, ThemeUtils.getColor(getActivity(), R.attr.colorMainTheme)); | |
PopupWindow popupWindow = new PopupWindow(root, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, true); | |
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.RED)); | |
popupWindow.setOutsideTouchable(true); | |
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { | |
@Override | |
public void onDismiss() { | |
btnActionMenu.setImageResource(ThemeUtils.getValueAttribute(getActivity(), R.attr.iconQues)); | |
} | |
}); | |
popupWindow.showAtLocation(btnActionMenu, Gravity.NO_GRAVITY, locScreen[0] + Utils.convertDpToPixel(20), locScreen[1] + Utils.convertDpToPixel(50)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment