我是喷气背包的新手,现在正在跟随this名导游.
当我try 创建我的标签时,我达到了UnresolvedReference
分,但我不确定为什么
@ExperimentalPagerApi
@ExperimentalMaterialApi
@Composable
fun Tabs(tabs: List<TabItem>, pagerState: PagerState) {
val scope = rememberCoroutineScope()
TabRow(
selectedTabIndex = pagerState.currentPage,
backgroundColor = colorResource(id = R.color.colorPrimaryDark),
contentColor = Color.White,
indicator = { tabPositions ->
TabRowDefaults.Indicator(
Modifier.pagerTabIndicatorOffset(pagerState, tabPositions)
)
}) {
tabs.forEachIndexed { index, tab ->
LeadingIconTab(
selected = pagerState.currentPage == index,
text = { Text(tab.title) },
icon = { Icon(painter = painterResource(id = tab.icon), contentDescription = "") },
onClick = {
scope.launch {
pagerState.animateScrollToPage(index)
}
},
)
}
}
其他的都行.我的build.gradle
里有implementation("com.google.accompanist:accompanist-pager:0.28.0")
个,我正在进口
我是不是错过了某个输入法或库?androidx.compose.ui.Modifier
个在类本身.我知道我在其他地方看到了这是一个常见的修饰符问题.