I`ll wish change the text size in run-time based in the old size.
How get a text size in SP (Scaled Pixel) directly from a TextView?
Something like:
textMove.setTextSize(textMove.getTextSPSize() + sizeFontScale);
I`ll wish change the text size in run-time based in the old size.
How get a text size in SP (Scaled Pixel) directly from a TextView?
Something like:
textMove.setTextSize(textMove.getTextSPSize() + sizeFontScale);
What about:
float px = editext.getTextSize(); float sp = px / getResources().getDisplayMetrics().scaledDensity;
So... setTextSize(int)
actually assumes Scaled Pixels. getTextSize()
returns the actual pixels. If you want to increase by an amount of actual pixels then you can call getTextSize()
, add whatever, then call setTextSize(TypedValue.COMPLEX_UNIT_PX, newValue)
. I guess I'm kind of wondering if you really want to do everything in Scaled Pixels.