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.
我有一个带有方法的自定义 Activity,在我的新项目中需要使用 ActionBarActivity。我无法扩展 ActionBarActivity,那么如何在不将它们的实现复制粘贴到 ActionBarActivity 的情况下使用自定义 Activity 的附加方法?
您可以public static在 CustomActiviy 中声明您的方法,然后您所要做的就是在 ActionBarActivity 上调用它们,例如:
public static
CustomActiviy.method(params);
将您的自定义活动扩展到 ActionBarActivity 并将您的正常活动扩展到 CustomActivity :)