LazyColumn 列表未显示在 jetpack 撰写中

发布于 2025-01-14 04:00:14 字数 1466 浏览 0 评论 0原文

我是 Jetpack Compose 的新手,我正在尝试创建一个代理列表应用程序,使用惰性列列出代理,但它现在显示..应用程序运行成功但结果没有得到,请给我一个解决方案。谢谢 库:https://github.com/gumify/hiper


@Preview
@Composable
fun App(){
    val hiper = Hiper.getInstance().async() // for asynchronous requests
    val Proxies = remember {mutableStateListOf<String>() }
    Surface(modifier = Modifier
        .fillMaxHeight()
        .fillMaxWidth()) {

           Column(modifier = Modifier
               .background(Color.Blue)
               .height(20.dp),
               horizontalAlignment = Alignment.CenterHorizontally) {

               Button (
                   modifier = Modifier.padding(all = Dp(10F)),

                   onClick = {
                       hiper.get("http://spys.me/proxy.txt") { response ->
                           if (response.isSuccessful) {
                               val lines = response.text.toString().split("\n")
                               for (line in lines) {
                                   Proxies.add(line)
                               }
                           }

                       }

                   }) {  Text(text = "Get Proxies") }

               LazyColumn( modifier = Modifier.background( color = Color.Gray)){
                   items(Proxies){item ->
                       Text(text = item)
                   }

           }
        }
    }

}

}

I m new To Jetpack Compose , i'm trying to create a Proxy list app , used lazy column to list proxies but its now showing .. app runs successfully but result not getting , Give Me a Solution . Thx
Lib : https://github.com/gumify/hiper


@Preview
@Composable
fun App(){
    val hiper = Hiper.getInstance().async() // for asynchronous requests
    val Proxies = remember {mutableStateListOf<String>() }
    Surface(modifier = Modifier
        .fillMaxHeight()
        .fillMaxWidth()) {

           Column(modifier = Modifier
               .background(Color.Blue)
               .height(20.dp),
               horizontalAlignment = Alignment.CenterHorizontally) {

               Button (
                   modifier = Modifier.padding(all = Dp(10F)),

                   onClick = {
                       hiper.get("http://spys.me/proxy.txt") { response ->
                           if (response.isSuccessful) {
                               val lines = response.text.toString().split("\n")
                               for (line in lines) {
                                   Proxies.add(line)
                               }
                           }

                       }

                   }) {  Text(text = "Get Proxies") }

               LazyColumn( modifier = Modifier.background( color = Color.Gray)){
                   items(Proxies){item ->
                       Text(text = item)
                   }

           }
        }
    }

}

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文