#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    65
    Rep Power
    2

    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.

    styles.xml
    Code:
    androidtextStyle = "bold"
    color, etc...?

    dimes.xml
    Code:
    android:layout_marginLeft = "@dimens/x" 
    android:paddingBottom = "@dimens/x" 
    android:textSize = "@dimens/x"
    ... any thing that has size?


    can you guys give me more tag ex so i can see more clearly?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Location
    Dallas, TX
    Posts
    50
    Rep Power
    1
    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:
    http://developer.android.com/guide/t...ui/themes.html

    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.

IMN logo majestic logo threadwatch logo seochat tools logo