语言

Menu
Sites
Language
App's background color and main theme background (specified using Styler)

I'm trying to make dialogs in my app look similar to dialogs of core (Samsung?) Tizen apps (Contacts, Calendar and so on). Thus, I'm using Genlist to build "forms".

However, items in my app have slightly different background (a shade of blue). This can be seen on the image:

My app to the left and core Settings app to the right.

How to make Genlist items use exactly the same background as core Tizen apps?

P.S. I'm testing this on Samsung Z1 (Tizen 2.4).

编辑者为: Andriy Lesyuk 04 8月, 2018

响应

11 回复
K Johnson

To implement a genlist with custom background, you've to create a custom style with EDC according to your requirement and then set it first to a layout object. After that you've to set the genlist to that custom style layout.

Please go through Stopwatch sample app's source code from Tizen Studio samples list. You'll find source code which will fulfill your requirement.

Andriy Lesyuk

I do not need Genlist with a custom background. I need a Genlist with exactly the same background, which is used in the core Tizen apps!

I.e., I need my app (to the left) have exactly the same gradient background as the core Settings app (to the right).

Tizen allows to specify custom color for UI backgrounds. I need my app to use that custom color, which is specified in the system, too. How do I achieve that?

K Johnson

To meet your requirement you've to use Genlist with custom background because by default Tizen offers Genlist with the color as it is in left picture. Please go through the sample app I've mentioned in my previous reply. It'll provide you the same Genlist color as it is in right picture of your original post. Run that sample app. When it gets launched, press start button first and then keep pressing lap button. It'll create exactly same Genlist you're trying to implement. 

Andriy Lesyuk

I checked the Stopwatch sample: The background, which is used in this sample, is not the same as backgrounds in core apps:

First: the core Clock app after a shade of blue was chosen in Styler. Second: the core Clock app with the previous color in Style. Third: the Stopwatch sample.

In the sample Stopwatch the background is just explicitly set to grey (slightly darker than the system grey). And, that's not what I want.

What I want is: to make my app respect the color, which is chosen in Styler. So, if a user chooses, e.g., orange, the background of Genlist items becomes slightly orange too. I expected, that this should have been so "out of the box", actually...

I have also discovered, that backgrounds of the Naviframe title and buttons in my app are also not changed, when I change the color in Styler. So, the problem is not in Genlist. The problem is that the whole app does not respect the color, which is chosen in Styler. Is there any way to fix this?

Andriy Lesyuk

According to this:

https://developer.tizen.org/design/mobile/styles

This is somehow related to the "main theme background", which (seems like) is not correct in my app.

K Johnson
Would you please try to modify the source code of Stopwatch sample app according to your requirement and check whether it works or not? I guess, it's possible to implement with this source code.
Andriy Lesyuk

Sorry, I'm not sure, what do you want me to modify? I did try running the sample Stopwatch - it does not work as expected, the background is not changed when I change the color in Styler.

K Johnson

I meant about changing color values in edc code and check whether it meets your requirement or not. I'll try to test that sample app source code with several changes towards your requirement and get back to you soon with the points where changes can be made.

K Johnson

Hi Andriy Lesyuk,

According to my understanding, you may keep color choosing and changing facility for the users of your app inside the app only but you can't sync it with the color selected from styler. I couldn't find any way to do so.

However, I could change color of genlist items as below image. If you still want to implement this type of thing than I can share the process.

Thanks.

Andriy Lesyuk

Thank you, K, very much for your attempt to find a solution to this problem! I greatly appreciate this!

But, that's not what I want. I'm interesting only in how to use the Styler's color in a custom Tizen native app. If this is not possible, I'm going to use the default colors, at least for now.

Anyway, I believe, that it's still worth sharing your code with the community. Someone else may find it handy (maybe, I will too, in some time, if I decide to use another static color).

P.S. Actually, I believe, that Tizen apps should have used the Styler's color by default. Obviously, users expect Styler to set the color for all apps, not only for the core ones... Weird, that it's not so.

K Johnson

I didn't make the implementation from scratch rather I had modified the source code of Stopwatch sample app from Tizen Studio. The last line of code of _on_content_get_cb callback in the view.c file of that project is changing the background color of each genlist item. I had changed the color value here as below line:

evas_object_color_set(bg, 575, 180, 100, _data->l_op);

You may set color values according to your requirement and here the alpha value is changing according to the lap time of stopwatch. It can be changed based on more complex conditions to get more color variation and play with the alpha values.