Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个View,我需要得到一个Activity它所在的layout位置View。我知道有一种getContext()方法View可以得到 a Context,但是有没有办法得到 a Activity?谢谢。
View
Activity
layout
getContext()
Context
您可以在视图上调用 getContext 并将其转换为 Activity 对象