Home>

Some methods that used without problems in android studio become deprecated and become a strikethrough.
How can I find a new method with the same function in these cases?

Example)
Although it is viewcompat.gettranslationy, it became unusable if it was API level 26.

Development environment)
Android Studio 3.1.4
pc: mac

  • Answer # 1

    Look at the documentation.
    Looking at the ViewCompat.getTrancelationY item,

      

    This method was deprecated in API level 26.1.0.
      Use getTranslationY () directly.

    (Respondent translation: This method has been deprecated at API level 26.1.0.
    Use the getTranslarionY () method directly. )

    There is

    . Since the method name is a link, if you fly,
    It seems that Viiew # getTrancelationY can be used.