Closed mkilp closed 6 years ago
Hey,
The method of moving the tooltip into correct position after content change is subject to recalculate the updated tooltip size and basicly is equivalent to adding a new tooltip. Have you tried to just remove the existing tooltip and add a new one with the updated content? If you did tried that and still want an option to update the tooltip content, can you explain in more details how it will help you?
Hey, The thing is: I'm currently displaying a tooltip called by an onTextChanged listener. Which means there are alot of updates to the tooltip depending on whats entered inside my app. Currently I get the tooltip view via the Tooltip manager, edit the text and translate the new X center to the center of the anchor view.
Sidenote: Quick question, do you know how to make your tooltips work inside a popup window? I'm building up the tips via
EditText currentJoins = popUpView.findViewById(R.id.currentjoins);
EditText maxJoins = popUpView.findViewById(R.id.maxjoins);
ToolTip.Builder currentJoinsBuilder = new ToolTip.Builder(mainLayout.getContext(), currentJoins,
mainLayout,
getString(R.string.help_current_members), ToolTip.POSITION_LEFT_TO);
currentJoinsBuilder.setBackgroundColor(getColor(R.color.btOrange));
currentJoinsBuilder.setTextAppearance(R.style.TooltipTextAppearance);
ToolTip.Builder maxJoinsBuilder = new ToolTip.Builder(mainLayout.getContext(), maxJoins,
mainLayout,
getString(R.string.help_maximum_members), ToolTip.POSITION_RIGHT_TO);
maxJoinsBuilder.setBackgroundColor(getColor(R.color.btOrange));
maxJoinsBuilder.setTextAppearance(R.style.TooltipTextAppearance);
and after the popupwindow is shown:
popupWindow = new PopupWindow(popUpView, width, height, focusable);
popupWindow.setAnimationStyle(R.style.Animation);
//show the popup
popupWindow.showAtLocation(mainLayout, Gravity.CENTER, 0, 0);
mToolTipsManager.show(currentJoinsBuilder.build());
mToolTipsManager.show(maxJoinsBuilder.build());
But it seems to not work sadly. Any ideas?
As I can understand from your example it seems that using the ToolTips library for your case is not the best choice. You are trying to achive a badge effect more then a tooltip effect. I would recommend you to create the currentJoin
view and maxJoin
view as part of your layout with a drawable as background and then you'll won't have any issue to update the text cause the layout constraints will make sure it will always be centered.
Regarding your sidenote, A quick check reveal that the coordinator finder return wrong values when trying to find the location of the popupWindow
thus placing the tooltip at a wrong position out of visible area.
Heya!
Im currently dealing with changing the text of a tooltip after creating it. With a new text its positioning above the view is incorrect.
I see you have a function for moving the tip, is it possible to make that function publich so someone can manually reposition the tooltip aligning with the view?
Thanks!
Marvin / Nop0x