【问题标题】:Custom launcher app icon issue?自定义启动器应用程序图标问题?
【发布时间】:2018-05-08 08:44:47
【问题描述】:

我得到了所有已安装应用程序的详细列表(app_name ,app package_name,app_icon)。

我附上了屏幕截图,它显示了我仍然面临的问题。

这是我的代码

  1. App List Adapter JAVA

  2. App List Cell_layout XML,在 XMl 中我也设置了 imageView scalType 但它不起作用。

  3. App List Activity JAVA

【问题讨论】:

  • 我认为是 android manifest 文件中的问题。
  • 我提供我的清单文件检查它是否缺少任何东西。
  • 没有问题!从我看的地方!那里你有高度和宽度的包装内容!我最好的猜测是你那里的图像大小不合适!有些图标让它们变成这样!
  • 可能是阴影和不可见的背景空间导致间距问题!在任何 Photoshop 工具中检查您的图标图像
  • @Rizwanatta 如何获取并打开我在 photoshop 的屏幕排序中提到的应用程序图标?

标签: java android android-layout android-launcher image-scaling


【解决方案1】:

所以这些是已安装应用程序的图标!现在只需为 imageView 固定大小(~50dp,~50dp)而不是 wrap_content

现在就这样做吧!现在应该可以解决问题了!

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center|top"
    android:orientation="vertical">


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:padding="@dimen/_10sdp">

            <ImageView
                android:id="@+id/ivAppIcon"
                android:layout_width="35dp"
                android:layout_height="35dp"
                android:src="@mipmap/ic_launcher" />

            <TextView
                android:id="@+id/tvAppLabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="@dimen/_5sdp"
                android:ellipsize="end"
                android:lines="1"
                android:maxEms="10"
                android:text="--"
                android:textColor="@color/colorWhite" />
        </LinearLayout>

【讨论】:

  • 是的它的工作我设置 iamgeView android:layout_width="@dimen/_40sdp" android:layout_height="@dimen/_40sdp" 谢谢
  • 请接受答案,这样它也可以帮助其他人!欢迎@Arbaz.in
  • 如果我忘记在我的问题中添加任何其他文件,请建议我。
【解决方案2】:

检查一下..

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.adruser.annotationdemo">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".interfaceclass.MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <activity android:name=".interfaceclass.SecondActivity"/>
</application>

</manifest>

【讨论】:

  • 你能解释一下我的清单文件有什么问题吗?我将此行放入 android manifest 以将活动设置为家庭活动
  • home 指的是ADW Launcher,LAUNCHER 指的是用来指定你的哪些activity可以启动。
  • 是的,你是对的,但我想将我的 android 活动作为 HOME 启动器启动
猜你喜欢
  • 2022-11-25
  • 2011-07-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-05-27
  • 1970-01-01
相关资源
最近更新 更多