是否可以同时扩展 Activity 类和 PreferenceActivity 类
我想要我的主课程为 2 个不同的标志创建活动。
1)一个具有相对布局 Textview 和图像,我将我的类扩展为
public class Abcd extends Activity implements View.OnClickListener, _
AdapterView.OnItemClickListener, ViewFactory{
2)第二个具有线性布局,以便具有 textview imageview 和列表。
现在,对于第二种情况,我想使用首选项屏幕而不是列表,为此我必须从 PreferenceActivity 扩展我的活动。
如果我可以的话,需要你的建议。
谢谢 瓦尼
I want to have my main class for creating activity for 2 different flags.
1) One with relative layout Textview and images for which I am extending my class as
public class Abcd extends Activity implements View.OnClickListener, _
AdapterView.OnItemClickListener, ViewFactory{
2) secondly with linear layout as to have a textview imageview and list.
now for the second case I want to use preferencescreen instead of list, for which I have to extend my activity from PreferenceActivity .
Need your suggestion if I can do so.
Thanks
Vani
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
VB 不支持,C# 也不支持。
这被称为多态性,如果您搜索该词,可以找到大量信息。
一般来说,您会需要多态性,因为您希望将两种类型的行为附加到类中 - 您可以通过使用 组合优于继承 - 如果您搜索该术语,同样可以找到大量建议。
VB does not support it, neither does C#.
This is referred to as Polymorphism and there's plenty of information available if you search for that word.
Generally you would want polymorphism because you want to attach two types of behavior to the class - you can achieve this just as easily by using composition over inheritance - again there is plenty of advice available if you search for that term.