Auto Generate @String reference in Android Studio

前端 未结 3 1720
梦如初夏
梦如初夏 2020-12-08 09:28

I know that this is possible in eclipse by following the advice here: Android: resource String automatic generation

But I can\'t seem to find if this is possible in

相关标签:
3条回答
  • 2020-12-08 09:48

    alt+Enter work when your setting string resource is on,

    how to on string resource extractor
    

    Goto Android studio 'Help' -> Find action -> type "extract string resource"

    You will find a ON / OFF button. Switch on the option.

    0 讨论(0)
  • 2020-12-08 09:50

    Alt+Enter, Extract String Resource while the caret is inside the hardcoded string:

    extract

    The same should work in XML files as well, and it does work in IntelliJ IDEA, but seems to be broken in the current version of the Android Studio:

    XML extract resource

    Android Studio 0.1.3 shows the folded text in XML layouts that it extracts from the string resources, but it fails to navigate back to the resource and doesn't offer to extract resources from the hardcoded strings inside XML. It appears to be a bug.

    0 讨论(0)
  • 2020-12-08 10:11

    What seems to be missing from the above answers is that, in Android Studio, you must place the cursor in the string, click the mouse, and press Alt + Enter to bring up the Extract String Resource dialog

    0 讨论(0)
提交回复
热议问题