如何在Android Studio中以简单的方式删除未使用的字符串资源项?

时间:2016-05-26 09:25:04

标签: android android-studio

我知道我可以使用快捷键 Ctrl + Alt + O 删除Android Studio中不必要的导入。

现在我的资源文件中有很多字符串资源名称,例如 strings.xml ,但是我的项目中使用了一些字符串资源名称。

是否有一种简单的方法可以删除这些未使用的字符串资源名称。

目前我必须手动删除项目<resources> <string name="app_name">Screen Recorder</string> <string name="BtnBuy">Purchase</string> <string name="BtnRetrieve">Retrieve</string> <string name="BuyPrompt">This is a trial version. It will be fully functional for 15 days. You can upgrade to the unlimited version and remove banner ads via an in-app purchase.</string> <string name="RetrievePrompt">If you have purchased the app, please click \'Retrieve\' button to recover.</string> <string name="MsgBillError">Problem setting up in-app billing: </string> <string name="MsgBillINI">An error occurred when initialize billing!</string> <string name="MsgOrderError">Purchasing error: </string> <string name="MsgOrderOK">You have purchased successfully! Please close and restart the app !</string> <string name="MsgInventoryFail">Failed to query inventory: </string> <string name="MsgRetrieveOK">You have retrieved your order info successfully! Please close and restart the app !</string> <string name="MsgRetrieveFail">You havn\'t purchased the app, please click \'Purchase\' button</string> <string name="ExpiredWarning">Warning</string> <string name="ExpiredTitle">The app expired, you can upgrade to the unlimited version and remove banner ads via an in-app purchase.</string> </resources> ,如果我发现我不再需要它。

的strings.xml

1) Some text is already present in Textbox.
2) Click on Radio button.
3) Processing popup is displayed for few seconds. After popup disappears the textbox 
   becomes blank
4) After textbox is blank then I have to enter different value in text box.

1 个答案:

答案 0 :(得分:6)

简单的解决方案是

从顶部栏中选择重构 - &gt;删除未使用的资源