1

I'm making an app that retrieve a lot of images from some server. I'm tinting each item in my List using Palette library. When a choose one I open another activity to show details of this item.

I want to build a theme based on the selected theme to apply in detail activity.

Is there a way to programmatically build a theme based on a Palette from a Bitmap?

Rodrigo Henriques
  • 1,804
  • 1
  • 15
  • 27
  • Yes! But is it about the styles, color or background? – T D Nguyen Nov 16 '15 at 00:40
  • I'm afraid not. Unless you instantiate components manually. However, you can quickly set the colors by calling specific methods of the components. If you are looking for a Palette that can be passed through activities, take a look at this https://gist.github.com/NikolaDespotoski/0c7ab7dba4f795891a26 – Nikola Despotoski Nov 16 '15 at 00:40
  • @NguyenDoanTung I wanna build a new theme with primary, primaryDark and accentColor to apply in my activity – Rodrigo Henriques Nov 16 '15 at 03:10
  • @NikolaDespotoski looks really cool but I still don't get how it could help me – Rodrigo Henriques Nov 16 '15 at 03:12

1 Answers1

1

If it is about the color of material design, there is a solution.

  1. Remember: You cannot change the modify those colors at runtime but you can switch between themes at activity start.
  2. When an user select a color, apply corresponding style and restart activity. Otherwise, change some other colors like Google keep
  3. To set theme .

    super.onCreate(savedInstanceState); setTheme(...style.YourTheme);

  4. To restart activity: Call the recreate() method of the activity.

Community
  • 1
  • 1
T D Nguyen
  • 7,054
  • 4
  • 51
  • 71