我有一个lazycolumn,使用detectTapGestures获取onclick事件
我想在单击Lazycolumn项时获取Lazycolumn的当前firstvisibleItemIndex
尝试了不同的解决方案与状态.firstVisibleItemIndex但没有工作-我如何才能开始?
Card(colors = CardDefaults.cardColors(
containerColor = Color(0xFF7DCEA0), Color.Black
),
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp),
modifier = Modifier
.padding(horizontal = 6.dp, vertical = 6.dp)
.offset { IntOffset(swipeableState.offset.value.roundToInt(), 0) }
.pointerInput(Unit) {
detectTapGestures(
onLongPress = {
// val firstVisibleItemIndex = state.firstVisibleItemIndex
mContext.startActivity(Intent(mContext, LKList::class.java))
},
onTap = {
Log.e(
"TestX",
">>>>>> DCMainItem : On Tap"
)
mContext.startActivity(Intent(mContext, DCInfo::class.java))
}
)
1条答案
按热度按时间kkih6yb81#
您可以使用类似于: