【问题标题】:Specify icon for Android apps on a TV that are different from the ones on mobile devices指定电视上不同于移动设备上的 Android 应用程序的图标
【发布时间】:2018-08-24 14:41:54
【问题描述】:

我有一个可以在 Amazon Fire TV 和移动设备上运行的 Android 应用。我希望在电视上运行的设备上显示某个图标,这应该与在移动设备上运行时的不同。

这是我在config.xml 文件中的图标设置:

<icon density="mdpi" src="../assets/img/myapp/drawable-mdpi/ic_launcher.png" />
<icon density="hdpi" src="../assets/img/myapp/drawable-hdpi/ic_launcher.png" />
<icon density="xhdpi" src="../assets/img/myapp/drawable-xhdpi/ic_launcher.png" />
<icon density="xxhdpi" src="../assets/img/myapp/drawable-xxhdpi/ic_launcher.png" />
<icon density="xxxhdpi" src="../assets/img/myapp/drawable-xxxhdpi/ic_launcher.png" />

电视图标的密度是多少?或者如何设置特定图标以在 960x540 的设备上显示?

谢谢!

【问题讨论】:

    标签: android android-tv android-screen-support amazon-fire-tv


    【解决方案1】:

    图标位于 res 文件夹中,在此文件夹中您有以下文件夹: - ic_launcher - ic_launcher_round

    xxxhdpi 图标的默认尺寸是 192 x 192 像素,请将您的图标放在此文件夹中。

    要指定开始图标,在AndroidManifest.xml中:

    <application Android: allowBackup = "true"
             android: icon = "@ mipmap / ic_launcher"
             android: roundIcon = "@ mipmap / ic_launcher_round"
             android: label = "@ string / app_name"
             android: theme = "@ style / AppTheme">
    

    要知道你可以使用的屏幕的密度、宽度和高度是多少:

    DisplayMetrics metrics = app.getResources (). GetDisplayMetrics ();
             int height = metrics.widthPixels;
             int width = metrics.widthPixels;
             int density = metrics.densityDpi;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多