Giter Site home page Giter Site logo

Comments (4)

skywalkerlw avatar skywalkerlw commented on August 22, 2024 1

The exception happened at the line of :
alpha = array.getColor(fadeOut, 0);

in the following code block:

public TooltipOverlayDrawable(Context context, int defStyleResId) {
        this.mOuterPaint.setStyle(Style.FILL);
        this.mInnerPaint.setStyle(Style.FILL);
        TypedArray array = context.getTheme().obtainStyledAttributes(defStyleResId, styleable.TooltipOverlay);

        for(int fadeIn = 0; fadeIn < array.getIndexCount(); ++fadeIn) {
            int fadeOut = array.getIndex(fadeIn);
            int alpha;
            if(fadeOut == styleable.TooltipOverlay_android_color) {
                alpha = array.getColor(fadeOut, 0);
                this.mOuterPaint.setColor(alpha);
                this.mInnerPaint.setColor(alpha);

Obviously, it is because that context.getTheme().obtainStyledAttributes does not include an attribute of color

So the solution could be: add following items into your theme:

<item name="colorAccent" tools:ignore="NewApi">#0092ff</item>
        <item name="colorPrimary" tools:ignore="NewApi">#ffcc00</item>
        <item name="colorPrimaryDark" tools:ignore="NewApi">#ff6600</item>

Frankly, the library could do something to avoid this issue without asking users to include above lines. :)

from android-target-tooltip.

skywalkerlw avatar skywalkerlw commented on August 22, 2024

same thing happen on me

I tried to call:

Tooltip.make(
getActivity(),
new Tooltip.Builder()
.anchor(getActivity().findViewById(R.id.help_button), Tooltip.Gravity.BOTTOM)
.fitToScreen(true)
.closePolicy(Tooltip.ClosePolicy.TOUCH_INSIDE_CONSUME, 10000)
.text("BOTTOM. Touch outside to dismiss the tooltip")
.withArrow(true)
.maxWidth(300)
.withStyleId(R.style.ToolTipLayoutDefaultStyle_Custom1)
.build()
).show();

and get the error of

java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x1c/d=0xff33b5e5 a=1 r=0x1060012}
at android.content.res.TypedArray.getColor(TypedArray.java:447)

from android-target-tooltip.

sephiroth74 avatar sephiroth74 commented on August 22, 2024

Can you also reproduce this with the sample app? Because it's working correctly here.

from android-target-tooltip.

milneti avatar milneti commented on August 22, 2024

I have this issue as well...

Was this going to be resolved? I attempted to add the attributes wangbourne described, but it is not solving the issue. Unless I am doing it incorrectly?

I attempted to extend the default:

<style name="MyTooltipStyle" parent="ToolTipOverlayDefaultStyle"> #0092ff #ffcc00 #ff6600 </style>

and add: withStyleId(R.style.MyTooltipStyle) to my builder

from android-target-tooltip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.