Is it possible?
Task: there are images of different sizes, on the image you need to add text to the entire image in height and proportionally in width. It is necessary that the font itself was selected depending on the size of the image.
There are several options for measuring the height of the image (transferring it to sp - optional) and setting or setting such a parameter in the markup:
Option 1:
int imageSize = imageView.getMeasuredHeight() float sp = imageSize / getResources().getDisplayMetrics().scaledDensity; textView.setTextSize(sp); Option 2 :
android:autoSizeTextType="uniform" Try what suits you best or look for something else to your taste.
Source: https://ru.stackoverflow.com/questions/979953/
All Articles
ImageViewandTextViewinto aFrameLayoutcontainer, then use autosizing in TextView - pavlofff