July 11th, 2013, 07:20 PM
Android - what are dimens.xml and styles.xml
so i know any text you want to add in ur android, you will create variable in strings.xml.
but what do you put in dimens.xml and styles.xml.
androidtextStyle = "bold"
... any thing that has size?
android:layout_marginLeft = "@dimens/x"
android:paddingBottom = "@dimens/x"
android:textSize = "@dimens/x"
can you guys give me more tag ex so i can see more clearly?
July 13th, 2013, 03:06 PM
Styles are a very powerful feature that you can implement to change the look and feel of UI elements easily while keeping the same underlying code base (and preventing the need to repeat the same XML layouts over and over again for similar elements). I use them particularly on notification dialogs, as I have apps that sometimes have similar notification UI's, but slightly different (color schemes, etc).
Check out Android's documentation on styles/themes, as it may help shed some light and give some examples:
As for the dimens file, I actually rarely use it (although there are probably some cases in which I could have used it to my advantage). It's just mainly for convenience if you have different UI elements that have the same dimensions, you can re-use those dimensions and read from that file rather than have them all explicitly hard-coded. That way, if they ever need to change, you only need to change them in one place rather than multiple places.