【问题标题】:Kotlin Emulator does not run app when as use a png image as drawable当使用 png 图像作为可绘制对象时,Kotlin Emulator 不会运行应用程序
【发布时间】:2022-10-31 16:26:59
【问题描述】:

我正在使用Android Studio Dolphin | 2021.3.1 和 Pixel 5 API 模拟器。

以下代码用于在按钮中显示图像。

但是当我使用calc.png 模拟器时说启动成功但退出应用程序。

如果我使用 xml 图像作为源,它工作正常。


Icon(imageVector = ImageVector.vectorResource(
   id = R.drawable.calc),
   modifier = Modifier.size(buttonWidth),
   contentDescription = "drawable icons",
   tint = Color.Unspecified
)

【问题讨论】:

    标签: android kotlin drawable


    【解决方案1】:

    当画家被使用它被工作。

            Icon(
                        painter = painterResource(R.drawable.calc),
                        modifier = Modifier.size(buttonWidth),
                        contentDescription = "drawable icons",
                        tint = Color.Unspecified
                    )
    

    【讨论】:

      猜你喜欢
      • 2016-05-22
      • 2013-12-11
      • 2014-09-17
      • 2020-06-11
      • 2011-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-09
      相关资源
      最近更新 更多