-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android support topbar title font scaling #7904
base: master
Are you sure you want to change the base?
Android support topbar title font scaling #7904
Conversation
import kotlin.math.roundToInt | ||
import kotlin.test.assertFalse | ||
|
||
private const val UUT_WIDTH = 1000 | ||
private const val UUT_HEIGHT = 100 | ||
|
||
@Config(sdk = [30]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
textSizeUnit is not available before api level 30
@@ -46,7 +48,16 @@ class TitleSubTitleLayout(context: Context) : LinearLayout(context) { | |||
} | |||
} | |||
|
|||
fun setTitleFontSize(size: Float) = titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, size) | |||
fun setTitleFontSize(size: Float) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For it to make sense from the perspective of options, I didn't find a way to set units without setting font size. Using titleTextView.textSize returns scaled font size, so need to have the absolute font size somewhere
Accessibility -> Display size and text -> Font size
Allowing font scaling in top bar title seems to be convention in "standard" Android apps:
Settings that can change font scaling in users' device