Giter Site home page Giter Site logo

Comments (7)

sytolk avatar sytolk commented on August 22, 2024 5

Just add

new Tooltip.Builder(101).withStyleId(R.style.ToolTipLayoutCustomStyle)

and in your style.xml you can set bold|italic or change textColor too

<style name="ToolTipLayoutCustomStyle">
        <item name="ttlm_padding">20dip</item>
        <item name="ttlm_strokeColor">#ffe5a000</item>
        <item name="ttlm_backgroundColor">#ffe5c700</item>
        <item name="ttlm_strokeWeight">1dip</item>
        <item name="ttlm_cornerRadius">10dip</item>
        <item name="ttlm_overlayStyle">@style/ToolTipOverlayCustomStyle</item>
        <item name="android:textAppearance">@style/ToolTipTextStyle</item>
    </style>

    <style name="ToolTipTextStyle">
        <item name="android:textStyle">bold|italic</item>
        <item name="android:textColor">@color/black_color</item>
    </style>

    <style name="ToolTipOverlayCustomStyle">
        <item name="android:color">@color/white_color</item>
        <item name="ttlm_repeatCount">1</item>
        <item name="ttlm_duration">600</item>
        <item name="android:alpha">0.2</item>
        <item name="android:layout_margin">8dp</item>
    </style>

maybe this is missing in README.md

from android-target-tooltip.

iam1492 avatar iam1492 commented on August 22, 2024 1

It was very late but simple and neat way is just override textcolor only.

<style name="ToolTipLayoutHoianStyle" parent="ToolTipLayoutDefaultStyle">
    <item name="android:textAppearance">@style/ToolTipTextStyle</item>
</style>

<style name="ToolTipTextStyle">
    <item name="android:textColor">@color/white</item>
</style>

from android-target-tooltip.

Desno365 avatar Desno365 commented on August 22, 2024

The easiest way I have found to change the text color is, as you said, changing the custom view.
It wasn't so difficult.
I just copied the tooltip_textview.xml of this library, added it to my project and added one line of code: android:textColor="@color/myColor". Then I have set the custom view to the Builder with this code .withCustomView(R.layout.tooltip_textview, false).

from android-target-tooltip.

kevinmost avatar kevinmost commented on August 22, 2024

I just hit this snag as well, where the custom style for the tooltip doesn't seem to respect android:textColor. Rather than use a custom view and lose the nice pointed arrow that comes with the built-in view, I did the following to make my tooltip's text white:

// Build your tooltip and show it first, then...
final View tooltipView = TooltipManager.getInstance().get(idUsedToCreateTooltip);
final TextView tooltipTextView = (TextView) tooltipView.findViewById(android.R.id.text1);
tooltipTextView.setTextColor(getResources().getColor(android.R.color.white));

from android-target-tooltip.

rohan20 avatar rohan20 commented on August 22, 2024

@Desno365 Can you please share the example using .withCustomView? For some reason, the tooltip doesn't pick anything else other than the XML attributes that were already there in tooltip_textview.

from android-target-tooltip.

Desno365 avatar Desno365 commented on August 22, 2024

@rohan20 I'm sorry but I commented on here 4 years ago. I don't even remember for what I used this library.

from android-target-tooltip.

jmsalcido avatar jmsalcido commented on August 22, 2024

See this:
https://github.com/sephiroth74/android-target-tooltip/blob/master/xtooltip/src/main/java/it/sephiroth/android/library/xtooltip/Tooltip.kt#L167

TooltipLayout_ttlm_textStyle

So using:

<style name="ToolTipLayoutDefaultStyle">
        <item name="ttlm_padding">30dp</item>
        <item name="ttlm_strokeColor">#2B3339</item>
        <item name="ttlm_backgroundColor">#2B3339</item>
        <item name="ttlm_strokeWeight">1dp</item>
        <item name="ttlm_cornerRadius">2dp</item>
        <item name="ttlm_arrowRatio">1</item>
        <item name="ttlm_elevation">4dp</item>
        <item name="ttlm_textStyle">@style/ToolTipTextStyleCustom</item>
    </style>

    <style name="ToolTipTextStyleCustom" parent="TextAppearance.AppCompat.Small">
        <item name="android:textColor">@color/white</item>
        <item name="android:textColorHighlight">@color/white</item>
        <item name="android:textColorHint">@color/white</item>
        <item name="android:textColorLink">@color/white</item>
        <item name="android:textSize">24sp</item>
    </style>

You will receive an error if you do not have these:

        <item name="android:textColorHighlight">@color/white</item>
        <item name="android:textColorHint">@color/white</item>
        <item name="android:textColorLink">@color/white</item>

since appcompat does not handle those.

Have fun like I had while debugging this.

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.