val pagerState = rememberPagerState()
Column {
Surface(elevation = 2.dp) {
Column() {
SearchView()
FixedTabLayout(data = tabs, pagerState = pagerState)
}
}
CommonSpacer(5)//convenient testing
...
}
private fun SearchView() {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
.padding(top = 8.dp, bottom = 8.dp)
.height(32.dp)
.background(colorResource(id = R.color.bgColorThird), RoundedCornerShape(32.dp)),
) {
...
}
}
@Composable
fun FixedTabLayout(pagerState: PagerState, data: List<String>) {
val coroutineScope = rememberCoroutineScope()
TabRow(
selectedTabIndex = pagerState.currentPage,
modifier = Modifier
.fillMaxWidth()
.height(42.dp),
backgroundColor = colorResource(id = R.color.white),
divider = {}
) {
...
}
}
I want to know why my Surface elevation setting does not work at this location. What I expect is that the searchView is above the tabLayout, and they are all at the top of the screen. The bottom of the tabLayout displays a 2dp shadow, just like covering the top of the screen。The picture below shows my current appearance and my expected appearance