Sunday, 18 August 2013

Android, different sizes in for same size in sp in code in xml

Android, different sizes in for same size in sp in code in xml

good day,
I was wondering, probably i do something wrong but i don't get it.
i defined
<dimen name="title">16sp</dimen>
When i set it in xml with something like
<TextView android:textSize="@dimen/title"/>
i get a different size (smaller) then when i set it in code.
int mTitleSize = res.getDimension(R.dimen.title);
textView.setHeight(mItemHeight);
I also tried
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTitleSize);
But that results in the same text size (still biger then the textview in xml.
Does anyone has the same experience/encoutered the same probleem and have
a solution (or just a solution)?
Thanks

No comments:

Post a Comment