I build this feature in my Android app.
If any resources tell me plz.
Thank for your time.
You can probably use DP multiplier coefficient, but I am more about Jetpack Compose
you should break your task down to smaller, actionable steps and if you'll encounter problems - post your question (right after googling and implementing solutions you've found there) some of these "actionable steps" would be: increasing text size, changing textview's parent size accordingly and of course remember to always include some context: are you building a chat? or a telegram clone? does this screen in the video look exactly like one in your app? etc
Steps that include actual UI writing are marked with (UI), which means that it depends on what you use - Compose or Views. I'll describe Compose steps but you can adapt it for Views Set up Datastore Preferences: - Add function for updating SP (text size unit) multiplier written in Datastore - Function for getting it - Use those functions in use cases layer to create TextSizeUsecase singleton which saves multiplier in memory on init and provides us with function for updating this value, and saves SP multiplier in Datastore on the end of app activity lifecycle - (UI) Update dependencies in ViewModels to inject text sizing use case - (UI) Every time you shall change text size, you can use multiplier right in code to multiply the text size as following: @Composable fun SizedTextScreen(viewModel: SizedTextViewModel = viewModel()) { val uiState = viewModel.uiState Text("This text uses size multiplier", size = (15 * uiState.textMultiplier)) }
@mawxim проблемы?
Thanks for your suggestion. But is it logical in every view to check text size -> if large/medium/small then change all texts in the views.
You can just use multiplier wherever you want. This is the most popular practice to implement custom text scaling in particular places
Обсуждают сегодня