Quantcast
Channel: Material icon size adjustment in Jetpack Compose? - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Material icon size adjustment in Jetpack Compose?

$
0
0

Jetpack compose provides a nice Icon() object to display icons that accepts a vector asset. Typically, you are able to set the size via a modifier:

Icon(Icons.Filled.PersonPin, Modifier.preferredSize(64.dp)) 

My problem is I cannot seem to affect the size of the displayed icon when I am using a provided system vector asset (ie, Icons.Filled. or Icons.Default. etc). When I use my own asset, things work as expected. Using the system assets the modifier only increases the UI footprint of the enclosing "box" while the icon stays tiny within:

Sample from IDE Preview

Applying the modifier using 'then' results in the same behavior:

    Icon(Icons.Filled.PersonPin,Modifier.then(Modifier.preferredSize(128.dp)))

Is there something about the native icons? I assumed being vector assets they should be able to resize as well.


Viewing all articles
Browse latest Browse all 7

Latest Images

Trending Articles





Latest Images