Issue
I am trying to customize the Typography in my project. But it not affected in my widgets.
My TypoGraphy customization:
src="https://i.stack.imgur.com/JvX12.png" alt="enter image description here" />
Code:
subtitle1 = TextStyle(
fontFamily = FontFamily.Monospace,
fontWeight = FontWeight.Bold,
fontSize = 30.sp,
)
In my Text :
Text(text = "Homemade veg pizza", style = MaterialTheme.typography.subtitle1)
My Output :
My problem: Fontsize and fontfamily not changed. It looks same like default text. How to set custom TypoGraphy in Jetpack Compose?
Solution
It's my mistake. I figure out.
We need to set the MaterialTheme before use custom TypoGraphy.
In my rootView I place my rootView under the MaterialTheme. Issue fixed.
setContent {
MaterialTheme { //I missed this line
ThemesRootView()
}
}
Output:
Answered By - Ranjithkumar
Answer Checked By - Robin (JavaFixing Admin)