3

I'm wondering how to make your MainScreen text same size on all devices(I'm using android studio) I have 65dp text, but once I run it on emulator which has bigger screen my text is much smaller.

Yeahia2508
  • 7,113
  • 13
  • 40
  • 67
Arthur
  • 149
  • 1
  • 10

3 Answers3

1

Never use "dp" for specifying textsizes. Always use "sp" for textsize and "dp" for everything else.

android:textSize="25sp"

android:layout_width="50dp"
Durga Mohan
  • 1,092
  • 8
  • 11
0

You could use the current resolution of the screen and the text size will be proportional for every single device. In this way you could use something like this:

//get your textView
TextView text = (TextView) findViewById(R.id.titleField);
text.setText("Your title here");
text.setTextSize(65 * getResources().getDisplayMetrics().density);

you could do this for every TextView in your MainScreen. Hopefully this helps you :)

P.S. You could find more suggestions for your case here: Text size with different resolution

Community
  • 1
  • 1
Gabriella Angelova
  • 2,959
  • 1
  • 18
  • 30
0

please check this https://stackoverflow.com/a/7608270/3353195

Blockquote

WarrenFaith The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".

Community
  • 1
  • 1
edward perines
  • 147
  • 1
  • 3