rharter / android-tooltips

Custom tooltips for android.
77 stars 28 forks source link

Could not place tooltip atop of target view with WRAP_CONTENT prop for width. #6

Open joshuamzm opened 9 years ago

joshuamzm commented 9 years ago

Is there any way to align a tooltip with Gravity.TOP set with a WRAP_CONTENT width just above target view?

E.g. tablet

Code involved:

View contentView = createToolTipView("Tooltip above the button",
        Color.BLACK, getResources().getColor(android.R.color.holo_green_light));

contentView.setLayoutParams(new ViewGroup.LayoutParams(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        ViewGroup.LayoutParams.WRAP_CONTENT
));

ToolTip t = new Builder(callingActivity)
        .anchor(targetView)
        .color(getResources().getColor(android.R.color.holo_green_light))
        .gravity(Gravity.TOP)
        .pointerSize(15)
        .contentView(contentView)
        .build();

tipContainer.addTooltip(t);