I have variable at dimens.xml
<resources>
<dimen name="btn_text_size">12sp</dimen>
</resources>
And i can use it in layout file:
<TextView
android:textSize="@dimen/btn_text_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dialog_tags_complete"
/>
or programmatically
tagButton.setTextSize(c.getResources().getDimension(R.dimen.tag_text_size));
But this 2 methods give different results. I know that getDimension
are based on the current DisplayMetrics associated with the resources.
But what should i do to make this 2 ways looks the same?