I am creating an application for use by pilots. Basically it uses TextView, EditText, Buttonetc. In other words, this is not a very heavy schedule.
TextView
EditText
Button
When used at night, I would like the user to switch to "night mode", where everything on the screen was red and black ... like the Google Sky Map application. (This is important for pilots, because red does not destroy the natural adaptation of night vision, as other colors do.)
What is the best way to do this? I found APIs such as ColorFilteretc., but I'm not sure how to apply these applications.
ColorFilter
If you are just talking about changing the colors of various representations in the layout, and not about the structure of the layout itself, I would suggest you just do it with styles.
i.e. Define two sets of styles for the different views that make up your layout — one set for night mode and one for day mode. In your activity, this becomes a challenge case setStyle()for each of your views to switch it between day and night.
setStyle()
To come up with a reasonable naming convention and a kinship scheme for your styles will make your life a lot easier. e.g. MyText.Largevs MyText.Large.Night.
MyText.Large
MyText.Large.Night
Android developer doc on themes and style is a good starting point.
. , , /.
Android, / . , ( ), ( ) ( ), . - "" "", , , "-night" , . :
res/drawable/fancy-button-background.9.png res/drawable-night/fancy-button-background.9.png
Android /, , , . , UiModeManager#setNightMode(). , , enableCarMode(0).
UiModeManager#setNightMode()
enableCarMode(0)