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,526
  • 14
  • 42
  • 71
Arthur
  • 149
  • 1
  • 11

2 Answers2

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,110
  • 9
  • 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,985
  • 1
  • 17
  • 30