Search code examples
androidandroid-tvleanback

Changing the default select color of action buttons in DetailsFragment in Leanback Library


enter image description hereHi Guys,

I want to change the color of default background color that comes on action button selection in details fragment.Any idea how the same can be acheived ?


Solution

  • You can do this using it's styles.xml which is provided by Lean Back library.

    Follow the steps below first.

    1. Go to your sdk -> extras -> android -> support -> v17 -> leanback -> res -> values.

    2. From there copy styles.xml file into your current leanback project folder.

    3. Now you have the style.xml file inside your project.

    4. Open that file and find below style.

    <style name="Widget.Leanback.DetailsActionButtonStyle" parent="Widget.Leanback.DetailsActionButtonStyleBase">

    Inside that you can add below property and you will have it's background color changed.

    <item name="android:background">@color/lb_speech_orb_recording</item>
    

    I have tested this my side and it's working let me know if you face any issue.

    Hope this will help you to get what exactly you need.