How Google Keep resizes the text of a note?

5.2k views Asked by At

I've been developing an application similar to the Google Keep, and was wondering how actually they allocate the text size to a note (algo)?

  • Do they just allocate size depending upon the Note length?
  • Or they also check for Card Dimensions i-e card width etc?

Its a bit confusing, because sometimes notes have equal card size dimensions with font-difference, and sometimes notes have both different size dimensions and text size?

So basically, the Question is, What is the algorithm/method to calculate the text size for a note?

enter image description here

1

There are 1 answers

1
Dhaval Parmar On

you have to use auto-fit TextView for this & add it in RecycleView or ListView(whatever you want) item layout. here is one of stack answer of AutoFit-TextView and source code from github android-autofittextview

apply max text size in TextView then it automatically adjust if there is more text

enter image description here

Do they just allocate size depending upon the Note length

No,

Or they also check for Card Dimensions i-e card width etc

No

just make you TexView size wrapcontent its allow you to add all text in textview like whatsup chat thread.


Edited

you have to manage like below way

*in Google keep text size depend of words. text length is 10 then maximum text size. text length is 30 then medium textsize and more then 50 then small text*

they are using two typeface one is for title and another is for text message