작성
·
191
0
Galaxy Nexus API 34 일 경우는 정상적으로 실행되나
Pixel 7 Pro APi 34 일 경우는 실행중에 에뮬레이터가 사라집니다
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
HomeScreen()
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun HomeScreen() {
Scaffold (
topBar = {
TopAppBar(
title = { Text("")},
actions = {
IconButton(onClick = {
}){
Icon(
imageVector = Icons.Default.ArrowBack,
contentDescription = "back",
tint = Color.White
)
}
IconButton(onClick = {
}){
Icon(
imageVector = Icons.Default.ArrowForward,
contentDescription = "forward",
tint = Color.White
)
}
}
)
}
) { paddingValues ->
Column(
modifier = Modifier
.padding(16.dp)
.fillMaxSize()
) {
OutlinedTextField(
value = "",
onValueChange = {},
label = { Text("https://")},
modifier = Modifier
.padding(paddingValues)
.fillMaxWidth(),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
keyboardActions = KeyboardActions(onSearch = {}),
)
Spacer(modifier = Modifier.height(16.dp))
MyWebView()
}
}
}
@Composable
fun MyWebView() {
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = {
WebView(it).apply {
settings.javaScriptEnabled = true
webViewClient = WebViewClient()
loadUrl("https://google.com")
}
},
update = {},
)
}