You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@PierfrancescoSoffritti
How to Change the Display Area in JetPack Compose: Tried fillMaxHeight, fillMaxSize, and Height, But Size Doesn't Change. Need Guidance.
youTubePlayerView.matchParent() <- crash
var jsonArray = mutableListOf<Questionnaire>()
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun SecondScreen() {
// Screen composable content
VerticalPagerParts(jsonArray.size)
}
@Composable
fun YouTubePlayerWrapper(videoId: String) {
val configuration = LocalConfiguration.current
val screenHeight = configuration.screenHeightDp.dp
AndroidView(
modifier = Modifier
.height(screenHeight)
.fillMaxHeight(),
factory = { context ->
val youTubePlayerView = YouTubePlayerView(context)
youTubePlayerView.apply {
addYouTubePlayerListener(object : AbstractYouTubePlayerListener() {
override fun onReady(youTubePlayer: YouTubePlayer) {
youTubePlayer.cueVideo(videoId, 0f)
Log.d("height",screenHeight.toString())
}
override fun onStateChange(
youTubePlayer: YouTubePlayer, state: PlayerConstants.PlayerState
) {
}
})
}
// youTubePlayerView.inflateCustomPlayerUi()
},
)
}
@Composable
@ExperimentalFoundationApi
fun VerticalPagerParts(pages: Int) {
val pagerState = rememberPagerState(pageCount = {
pages
})
val videoIds = jsonArray.let { data ->
data.mapNotNull { it.videoId }
}
VerticalPager(
state = pagerState,
modifier = Modifier.fillMaxHeight()
) { page ->
YouTubePlayerWrapper(videoId = videoIds[page])
}
}
Current Layout
Desired Layout
The text was updated successfully, but these errors were encountered:
Question / Problem
@PierfrancescoSoffritti
How to Change the Display Area in JetPack Compose: Tried fillMaxHeight, fillMaxSize, and Height, But Size Doesn't Change. Need Guidance.
youTubePlayerView.matchParent() <- crash
Current Layout
Desired Layout
The text was updated successfully, but these errors were encountered: