Well, I resolved my problem :
What I'm doing is taking the size of a RelativeLayout, and my TextView is inside. Then I dimensioned the TextView programmatically and use setAutoTypeUniform function to fit the text in my layout.
rl_get_coins.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
rl_get_coins.getViewTreeObserver().removeOnGlobalLayoutListener(this);
height = rl_get_coins.getHeight(); //height is ready
width = rl_get_coins.getWidth(); //height is ready
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) text_get_coins.getLayoutParams();
params.height = height;
params.width = width;
text_get_coins.setLayoutParams(params);
text_get_coins.setText("Obtenir");
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(text_get_coins, 1, 17, 1,
TypedValue.COMPLEX_UNIT_DIP);
}
});
well guys, if you have any problem, tell it to me. I so happy that it works for me !
Made by a made by stackoverflow, so happy, I did it lol