I\'ve had a good search for this on here and can\'t find a solution.
I have a TextView in a RelativeLayout which contains an integer number. The number will range be
Best way is to use TextPaint. Here is a simple example:
TextPaint textPaint = new TextPaint();
textPaint.setTextSize(yourTextView.getTextSize());
yourTextView.setMinWidth((int) textPaint.measureText("-88.88"));
Do not forget to specify text size in your TextPaint object
In measureText enter longest possible string you're expecting to see (I've written "-88.88" assuming my text can handle positive or negative numbers below 100 with 2 digits after comma)