如何改变发射器的图标,它的标签从应用程序它的、发射器、应用程序、图标

2023-09-05 10:27:43 作者:除ㄋ迩ッ莪誰都卟娶

我如何可以改变从我的Andr​​oid应用程序运行时的启动图标,它的标签? (如果有可能) 我的意思是在的Andr​​oidManifest.xml 定义的属性:安卓图标安卓标签。我想通过我从相机的图像来取代它。

How can I change the launcher icon and its label from my application runtime in Android? (if it is possible) I mean the properties defined in AndroidManifest.xml: android:icon and android:label. I want to replace it by the image I take from the camera.

推荐答案

编辑:你原来的答案并没有说明你想在运行时做到这一点。下面的线是如何做到这一点它编译之前。至于编程方式做它在运行时:

your original answer didn't specify you wanted to do it at runtime. Below the line is how to do it before it compiles. As for doing it programmatically at runtime:

从this回答:

您不能更改舱单或签字,并密封APK资源,除了通过软件升级。

You cannot change the manifest or the resource in the signed-and-sealed APK, except through a software upgrade.

但同时,公认的答案想出了一个黑客或一些作弊的方式来做到这一点(我presume)。我没有测试过,但你签出源。

But also, the accepted answer figured out a "hack" or some cheating way to do it (I presume). I haven't tested it, but there is a source for you to check out.

或者,此链接显然说明如何使用要做到这一点小部件的方法。

Or, this link apparently describes how to do this using the "widget" approach.

因此​​,可以说你的表现是这样的:

So lets say your manifest was like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="yourPackage"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

     ...

您会通过将图像转换成你的绘制文件夹更改启动器图标:

You would change the launcher icon by putting images into your drawable folders:

Project folder --> res --> all the drawables

然后你会改变安卓图标=@可绘制/ ic_launcher安卓图标=@可绘制/ whateverTheNameOfTheImageIsYouPutInTheDrawablesFolders

要更改标签:

打开你的的strings.xml 文件,该文件位于:

Open up your strings.xml file which is located:

Project folder --> res --> values --> strings.xml

和寻找那些看起来像这样的字符串:

And look for the string that looks like this:

<string name="app_name">Your App Name</string>

和只需更改的程序名称是任何你想要的标签设置。

And just change Your App Name to be whatever you want the label to be.

摘要:

安卓图标=@可绘制/ ic_launcher决定你的发射器的图标,所以只需将图像添加到绘制的文件夹,并更改 ic_launcher 的任何图像的名字是你想成为的图标。

android:icon="@drawable/ic_launcher" determines your launcher icon, so just add images to the drawable folders and change ic_launcher to whatever the name of image is that you want to be the icon.

机器人:标签=@字符串/ APP_NAME决定你的标签,所以只是看 APP_NAME (因为标签是参照 @在你的的strings.xml 文件字符串/ APP_NAME ),并更改 APP_NAME 。

android:label="@string/app_name" determines your "label" so just look for app_name (because the label is referenced to @string/app_name) in your strings.xml file and change the contents of app_name.