FAB backgroundTintList, doesn't work and sets border colorAndroid FAB icon always black with MaterialComponents themeStandard Android Button with a different colorAndroid SDK installation doesn't find JDKHow to set the text color of TextView in code?Set TextView style (bold or italic)Set EditText cursor colorHex transparency in colorsWhy doesn't RecyclerView have onItemClickListener()?Android changing Floating Action Button colorSet FAB icon colorSet FAB Border color

What are the uses and limitations of Persuasion, Insight, and Deception against other PCs?

Does a code snippet compile? Or does it get compiled?

Was the 2019 Lion King film made through motion capture?

changing number of arguments to a function in secondary evaluation

Carbs Vs Fat - Which is better for weight loss

Christian apologetics regarding the killing of innocent children during the Genesis flood

Blocking people from taking pictures of me with smartphone

Is it really ~648.69 km/s delta-v to "land" on the surface of the Sun?

Why do funding agencies like the NSF not publish accepted grants?

Ordering a word list

First amendment and employment: Can a police department terminate an officer for speech?

Team goes to lunch frequently, I do intermittent fasting but still want to socialize

Euler products in positive characteristic? [reference request]

Who are these characters/superheroes in the posters from Chris's room in Family Guy?

In a topological space if there exists a loop that cannot be contracted to a point does there exist a simple loop that cannot be contracted also?

Visa National - No Exit Stamp From France on Return to the UK

AsyncDictionary - Can you break thread safety?

Should you play baroque pieces a semitone lower?

Ex-contractor published company source code and secrets online

Dropdowns & Chevrons for Right to Left languages

A tool to replace all words with antonyms

Why do oscilloscopes use SMPSes instead of linear power supplies?

Write an interpreter for *

How to avoid the "need" to learn more before conducting research?



FAB backgroundTintList, doesn't work and sets border color


Android FAB icon always black with MaterialComponents themeStandard Android Button with a different colorAndroid SDK installation doesn't find JDKHow to set the text color of TextView in code?Set TextView style (bold or italic)Set EditText cursor colorHex transparency in colorsWhy doesn't RecyclerView have onItemClickListener()?Android changing Floating Action Button colorSet FAB icon colorSet FAB Border color






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















If you use it in XML it works, but you can't set it programatically. I'm using this library:



implementation 'com.google.android.material:material:1.0.0'


For example:



filterHistoryFab.backgroundTintList = ContextCompat.getColorStateList(context!!, R.color.pink)


XML:



 <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/filterHistoryFab"
style="@style/FloatingActionButton"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/ic_filter_white" />


Style:



<style name="FloatingActionButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:backgroundTint">@color/dark_blue</item>
<item name="android:layout_margin">@dimen/fab_margin</item>
<item name="android:background">?attr/selectableItemBackgroundBorderless</item>
</style>


The background should be PINK, but it stays BLUE, with some pink in behind.
Link to how it looks: LINK










share|improve this question
























  • stackoverflow.com/q/53365618/7666442

    – Nilesh Rathod
    Mar 27 at 8:25











  • Thank you for the answer, but that is for tint of the icon and not background.

    – WinterChilly
    Mar 27 at 8:32

















0















If you use it in XML it works, but you can't set it programatically. I'm using this library:



implementation 'com.google.android.material:material:1.0.0'


For example:



filterHistoryFab.backgroundTintList = ContextCompat.getColorStateList(context!!, R.color.pink)


XML:



 <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/filterHistoryFab"
style="@style/FloatingActionButton"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/ic_filter_white" />


Style:



<style name="FloatingActionButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:backgroundTint">@color/dark_blue</item>
<item name="android:layout_margin">@dimen/fab_margin</item>
<item name="android:background">?attr/selectableItemBackgroundBorderless</item>
</style>


The background should be PINK, but it stays BLUE, with some pink in behind.
Link to how it looks: LINK










share|improve this question
























  • stackoverflow.com/q/53365618/7666442

    – Nilesh Rathod
    Mar 27 at 8:25











  • Thank you for the answer, but that is for tint of the icon and not background.

    – WinterChilly
    Mar 27 at 8:32













0












0








0








If you use it in XML it works, but you can't set it programatically. I'm using this library:



implementation 'com.google.android.material:material:1.0.0'


For example:



filterHistoryFab.backgroundTintList = ContextCompat.getColorStateList(context!!, R.color.pink)


XML:



 <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/filterHistoryFab"
style="@style/FloatingActionButton"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/ic_filter_white" />


Style:



<style name="FloatingActionButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:backgroundTint">@color/dark_blue</item>
<item name="android:layout_margin">@dimen/fab_margin</item>
<item name="android:background">?attr/selectableItemBackgroundBorderless</item>
</style>


The background should be PINK, but it stays BLUE, with some pink in behind.
Link to how it looks: LINK










share|improve this question














If you use it in XML it works, but you can't set it programatically. I'm using this library:



implementation 'com.google.android.material:material:1.0.0'


For example:



filterHistoryFab.backgroundTintList = ContextCompat.getColorStateList(context!!, R.color.pink)


XML:



 <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/filterHistoryFab"
style="@style/FloatingActionButton"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/ic_filter_white" />


Style:



<style name="FloatingActionButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:backgroundTint">@color/dark_blue</item>
<item name="android:layout_margin">@dimen/fab_margin</item>
<item name="android:background">?attr/selectableItemBackgroundBorderless</item>
</style>


The background should be PINK, but it stays BLUE, with some pink in behind.
Link to how it looks: LINK







android floating-action-button






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 8:21









WinterChillyWinterChilly

77413 silver badges23 bronze badges




77413 silver badges23 bronze badges















  • stackoverflow.com/q/53365618/7666442

    – Nilesh Rathod
    Mar 27 at 8:25











  • Thank you for the answer, but that is for tint of the icon and not background.

    – WinterChilly
    Mar 27 at 8:32

















  • stackoverflow.com/q/53365618/7666442

    – Nilesh Rathod
    Mar 27 at 8:25











  • Thank you for the answer, but that is for tint of the icon and not background.

    – WinterChilly
    Mar 27 at 8:32
















stackoverflow.com/q/53365618/7666442

– Nilesh Rathod
Mar 27 at 8:25





stackoverflow.com/q/53365618/7666442

– Nilesh Rathod
Mar 27 at 8:25













Thank you for the answer, but that is for tint of the icon and not background.

– WinterChilly
Mar 27 at 8:32





Thank you for the answer, but that is for tint of the icon and not background.

– WinterChilly
Mar 27 at 8:32












1 Answer
1






active

oldest

votes


















0














I figured it out. If you set in STYLE backgroundTint it will not work programatically. Maybe this is a bug. So the solution is to just remove this line:



 <item name="android:backgroundTint">@color/dark_blue</item>


And it works perfectly.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55372617%2ffab-backgroundtintlist-doesnt-work-and-sets-border-color%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I figured it out. If you set in STYLE backgroundTint it will not work programatically. Maybe this is a bug. So the solution is to just remove this line:



     <item name="android:backgroundTint">@color/dark_blue</item>


    And it works perfectly.






    share|improve this answer





























      0














      I figured it out. If you set in STYLE backgroundTint it will not work programatically. Maybe this is a bug. So the solution is to just remove this line:



       <item name="android:backgroundTint">@color/dark_blue</item>


      And it works perfectly.






      share|improve this answer



























        0












        0








        0







        I figured it out. If you set in STYLE backgroundTint it will not work programatically. Maybe this is a bug. So the solution is to just remove this line:



         <item name="android:backgroundTint">@color/dark_blue</item>


        And it works perfectly.






        share|improve this answer













        I figured it out. If you set in STYLE backgroundTint it will not work programatically. Maybe this is a bug. So the solution is to just remove this line:



         <item name="android:backgroundTint">@color/dark_blue</item>


        And it works perfectly.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 27 at 9:27









        WinterChillyWinterChilly

        77413 silver badges23 bronze badges




        77413 silver badges23 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55372617%2ffab-backgroundtintlist-doesnt-work-and-sets-border-color%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown