We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在你的说明中关于如何拿到Context说到:在 Android 开发中,任何 View 对象都能通过 view.getContext() 拿到 Context 对象,这些对象本质上都是 Activity 对象的引用。 实际上当Activities 继承至 AppCompatActivity时。从 23.3.0 开始 View.getContext() 返回的是 TintContextWrapper 而不是 Activity,一些用到Context的地方并不会出现什么问题,但是将Context强转成Activity就会报错了,详见 https://stackoverflow.com/questions/38814267/android-support-v7-widget-tintcontextwrapper-cannot-be-cast
The text was updated successfully, but these errors were encountered:
是的,你说的对,感谢指出!晚点时间更正。
Sorry, something went wrong.
目前发现,至少在使用 26.0.0 版 support 库时,View.getContext() 返回的确实是 Activity,看来官方已经改正了这个设计了。wiki 看起来可以改回来了。
No branches or pull requests
在你的说明中关于如何拿到Context说到:在 Android 开发中,任何 View 对象都能通过 view.getContext() 拿到 Context 对象,这些对象本质上都是 Activity 对象的引用。
实际上当Activities 继承至 AppCompatActivity时。从 23.3.0 开始 View.getContext() 返回的是
TintContextWrapper 而不是 Activity,一些用到Context的地方并不会出现什么问题,但是将Context强转成Activity就会报错了,详见 https://stackoverflow.com/questions/38814267/android-support-v7-widget-tintcontextwrapper-cannot-be-cast
The text was updated successfully, but these errors were encountered: