【开发者教程】添加“毒蛇微调”此类软件到设置页面教程

1.public.xml中添加:

<public type=”drawable” name=”icon_XXX” id=”0x7f020182″ /> “icon_XXX是你的添加的图标名称,这里的ID根据你public中的drawable中的最后的代码加大一位就可以”
<public type=”string” name=”XXX” id=”0x7f0b0ddg” /> “XXX是你string.xml中添加软件名称的代码,这里的ID根据你public中的string中的最后的代码加大一位就可以”

2.strings.xml中添加:
<string name=”hub”>XXX</string>

3.复制ic_XXX.png到res\drawable-hdpi中

4.在\Settings\smali\com\android\settings\framework\activity\HtcEntryProxy.smali中添加代码:

    iput v5, v2, Lcom/android/settings/framework/activity/HtcWrapHeader;->index:I

    sget-object v7, Lcom/android/settings/framework/activity/HtcWrapHeader$Type;->NORMAL:Lcom/android/settings/framework/activity/HtcWrapHeader$Type;

    iput-object v7, v2, Lcom/android/settings/framework/activity/HtcWrapHeader;->type:Lcom/android/settings/framework/activity/HtcWrapHeader$Type;

    iget-object v7, v2, Lcom/android/settings/framework/activity/HtcWrapHeader;->info:Lcom/htc/preference/HtcPreferenceActivity$Header;

    const v9, 0x7f020182 ##//”这里是要集成软件的drawable的ID“

    iput v9, v7, Lcom/htc/preference/HtcPreferenceActivity$Header;->iconRes:I

    iget-object v7, v2, Lcom/android/settings/framework/activity/HtcWrapHeader;->info:Lcom/htc/preference/HtcPreferenceActivity$Header;

    const v9, 0x7f0b0ddg ##//”这里是要集成软件的string的ID“

    iput v9, v7, Lcom/htc/preference/HtcPreferenceActivity$Header;->titleRes:I

    iget-object v7, v2, Lcom/android/settings/framework/activity/HtcWrapHeader;->info:Lcom/htc/preference/HtcPreferenceActivity$Header;

    new-instance v9, Landroid/content/Intent;

    const-string v10, “android.intent.action.MAIN”

    invoke-direct {v9, v10}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    const-string v11, “com.XXX.XXX” ##//”这里是要集成软件的AndroidManifest.xml中的”package=”com.XXX.XXX”“

    const-string v10, “com.XXX.XXX.MainActivity” ##//”这里是要集成软件的AndroidManifest.xml中的<activity android:label=”@string/app_name” android:name=”com.XXX.XXX.MainActivity”>“

    invoke-virtual {v9, v11, v10}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    move-result-object v9

    iput-object v9, v7, Lcom/htc/preference/HtcPreferenceActivity$Header;->intent:Landroid/content/Intent;

    const/4 v7, 0x0

    iput-boolean v7, v2, Lcom/android/settings/framework/activity/HtcWrapHeader;->hide:Z

    invoke-virtual {v2, p0}, Lcom/android/settings/framework/activity/HtcWrapHeader;->prepareExtraInfo(Landroid/content/Context;)V

    sget v7, Lcom/android/settings/framework/activity/HtcEntryProxy;->sAvailableCount:I

    add-int/lit8 v7, v7, 0x1

    sput v7, Lcom/android/settings/framework/activity/HtcEntryProxy;->sAvailableCount:I

    new-instance v2, Lcom/android/settings/framework/activity/HtcWrapHeader;

    invoke-direct {v2}, Lcom/android/settings/framework/activity/HtcWrapHeader;-><init>()V

    invoke-virtual {v1, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    add-int/lit8 v5, v4, 0x1

原文链接:,转发请注明来源!