Xamarin Android - Setting TextSize from Dimension file
<p>I have a Xamarin Android project where I am using dimension files to specify text sizes, paddings, margins etc for different screen sizes/resolutions.</p>

<p>I have noticed that there is a pronounced difference between setting the value directly within the layout and within code.</p>

<p>For example, if I add the following to a TextView the layout XML</p>

<p><code>android:textSize="@dimen/nav_tile_text_size"</code></p>

<p>then I would expect the result to be the same as doing this in code</p>

<p><code>myTextView.SetTextSize(ComplexUnitType.Sp, _context.Resources.GetDimension(Resource.Dimension.nav_tile_text_size))</code></p>

<p>The dimension file contains the following:</p>

<p><code>&lt;dimen name="nav_tile_text_size"&gt;17sp&lt;/dimen&gt;</code></p>

<p>but the resulting UI shows that the size has not been correctly applied</p>

<p><a href="https://i.stack.imgur.com/exs8o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/exs8o.png" alt="Emulator Screenshot"></a></p>

<p>What am I missing here??</p>