Archive for the ‘Colour’ Category

App UI / UX – Part 1

Friday, May 23rd, 2014

In the previous series on Bluetooth LE we got a simple app working which read temperature and humidity values from a Texas Instruments SensorTag, and displayed them. Functionally the app worked quite well but, because the series was focused on BLE topics, we neglected the UI somewhat. In this series we’ll take a look at various techniques that we can employ to make our app feel much nicer, and provide a richer and, hopefully, more engaging experience for the user.


Friday, April 8th, 2011

Note: I will use the UK and US spellings of colour / color interchangeably in this article because in some places the syntax and naming conventions dictate the US spelling. Where necessary, I shall use the spelling required by Android for it to work and highlight where spelling is important.

Up until now, we have specified colours where we need them as #RRGGBB values. While this has worked well for us, it can become difficult to maintain as projects grow in size. For example, if we have a specific shade of green, like the one that we used to style the button in the last article, and we use that in a large number of different styles and drawables. If we need to make a change to that shade of green, then tracking down and changing each instance where we use it, can be time consuming and, more significantly, prone to error. Thankfully there is a solution: colour resources – A resources file, which we create at res/values/colours.xml. Note: I have used the UK spelling for this file name, and the actual file name is not important – it is the elements within the file which need to be spelled correctly. Moreover, it is possible to store colour definitions, and indeed any resources, across multiple files without any strict naming conventions. However it is useful to store resources of the same type in a single file to make it easier to maintain your code.