0

Where does the value associated with this "x_offset" come from or what does it represent? And is it an absolute or relative to width value?

Edit: the default value is 15dp which is about a third of the text size. (info form Clement Amarnath's link: https://developer.android.com/samples/WatchFace/Wearable/res/values/dimens.html)

Edit2: Specifically, I would like to know if there are any cases where a programmer should use this value instead of generating their own values based on screen size and density?

kjl
  • 311
  • 3
  • 13

1 Answers1

0

Where does the value associated with this "x_offset" come from

digital_x_offset value is coming from dimens.xml

Please refer the below documentation

https://developer.android.com/samples/WatchFace/Wearable/res/values/dimens.html


EDIT

Read this post How to define dimens.xml for every different screen size in android? it provides a good amount of info on dimens.xml


Offset helps us in placing our frame in the main frame, we can position our frame from the left, right, top or bottom in the main frame/window.

<dimen name="digital_x_offset">15dp</dimen> This statement of xoffset in dimens.xml means it is the distance from the left side of the screen/frame/window.

<dimen name="digital_y_offset">80dp</dimen> This statement of yoffset in dimens.xml means it is the distance from the top of the screen.

Community
  • 1
  • 1
Clement Amarnath
  • 5,301
  • 1
  • 21
  • 34
  • Thank you for providing the link to the default values, that helps some. It tells me that the value is scales with screen density but not user preference. Yet I would like to know where the value comes from conceptually. – kjl Jul 15 '16 at 05:33
  • thank you for the link to How to define dimens.xml for every different screen size in android? It is a good discussion on how to address different screen sizes, but I found no mention of what the x_offset signified. – kjl Jul 16 '16 at 19:28
  • @kjl - I have added details about offset, please go thru it, Also please spend more time on reading documentation. – Clement Amarnath Jul 17 '16 at 03:07
  • Is it based on how much the screen moves for screen burn, the size of text characters, the expected size of scroll bars, etc, or just a recommended aesthetic for margins? – kjl Jul 17 '16 at 15:33