Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Compose - Can't use Modifier.align()

I use Compose version 1.0.0-beta06, I can't call Modifier.align() method

build.gradle

    // Compose
    implementation 'androidx.compose.ui:ui:1.0.0-beta06'
    implementation 'androidx.compose.ui:ui-tooling:1.0.0-beta06'
    implementation 'androidx.compose.foundation:foundation:1.0.0-beta06'
    implementation 'androidx.compose.material:material:1.0.0-beta06'
    implementation 'androidx.compose.material:material-icons-core:1.0.0-beta06'
    implementation 'androidx.compose.material:material-icons-extended:1.0.0-beta06'
    implementation 'androidx.activity:activity-compose:1.3.0-alpha07'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha04'
    implementation 'androidx.compose.runtime:runtime-livedata:1.0.0-beta06'
    implementation 'androidx.compose.runtime:runtime-rxjava2:1.0.0-beta06'

    // Compose Accompanist
    implementation 'com.google.accompanist:accompanist-coil:0.9.1'
    implementation 'com.google.accompanist:accompanist-pager:0.9.1'
    implementation 'com.google.accompanist:accompanist-pager-indicators:0.9.1'
    implementation 'com.google.accompanist:accompanist-systemuicontroller:0.9.1'

    // Compose other libs
    implementation("androidx.compose.ui:ui-util:1.0.0-beta06")

Library contain this method image-1

But, I can't call it image-2

Please help me. Thanks!

like image 340
PhongBM Avatar asked May 07 '26 03:05

PhongBM


1 Answers

The align() method is part of the BoxScope DSL. In order to use the method , you should be inside a Box, not inside a Row as in your example.

like image 113
gpo Avatar answered May 08 '26 16:05

gpo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!