简体   繁体   English

具有列表活动的自定义标题栏

[英]Custom title bar with list Activity

I have two activities , One extending the List Activity and other extending the Activty 我有两个活动,一个扩展了列表活动,另一个扩展了Activty

I want to use custom title bar with both the activties. 我想对两个活动都使用自定义标题栏。 How is it possible? 这怎么可能?

If i make a seperate class(extending activity) for custom title bar, then i could only use it for my second activity(that extends activity). 如果我为自定义标题栏创建了单独的类(扩展活动),那么我只能将其用于第二个活动(扩展活动)。 How could i use it to extend my first activity(extending list activity) 我如何使用它来扩展我的第一个活动(扩展列表活动)

您可以创建一个名为TitleBarCompat的类,并在构造函数中将Activity作为参数,然后在其中创建自定义标题栏,并提供在Activity中使用它的方法,然后可以在所有Activity及其子类中调用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM