简体   繁体   English

在Appcompat-v7中,如果没有Actionbar,我可以使用Activity而不是ActionbarActivity吗?

[英]Can I use Activity instead of ActionbarActivity without Actionbar at Appcompat-v7?

I want to use Material design at under-Lolipop version of Android. 我想在Android的Lolipop版本下使用Material设计。

I know, 我知道,

  1. I must use AppTheme : Appcompat-v7 我必须使用AppTheme:Appcompat-v7
  2. To use Actionbar with Appcompat-v7, I must extends ActionbarActivity 要将Actionbar与Appcompat-v7一起使用,我必须扩展ActionbarActivity

But, I don't want to use ActionbarActivity, because of quite diffrence with Activity and It just looks like unflexible to me, and that makes me nervous to use ActionbarActivity. 但是,我不想使用ActionbarActivity,因为与Activity非常不同,它对我来说看起来不灵活,这让我对使用ActionbarActivity感到紧张。 It looks like just Activity class for Actionbar. 它看起来就像Actionbar的Activity类。

So, I think about use Toolbar(stand-alone) instead of Actionbar. 所以,我考虑使用Toolbar(独立)而不是Actionbar。 And It seems when I don't use Actionbar, then don't have to use ActionbarActivity either. 而且当我不使用Actionbar时,似乎也不必使用ActionbarActivity。

Finally, I find a solution that use below. 最后,我找到了一个在下面使用的解决方案。

  1. AppTheme : Appcompat-v7 21 AppTheme:Appcompat-v7 21
  2. Toolbar(instead of Actionbar) 工具栏(而不是Actionbar)
  3. Activity(instead of ActionbarActivity) 活动(而不是ActionbarActivity)

Did you think this is aright way? 你认为这是正确的方式吗? or it just doesn't make sense at all? 或者它根本没有意义?

But, I don't want to use ActionbarActivity, because of quite diffrence with Activity and It just looks like unflexible to me, and that makes me nervous to use ActionbarActivity. 但是,我不想使用ActionbarActivity,因为与Activity非常不同,它对我来说看起来不灵活,这让我对使用ActionbarActivity感到紧张。 It looks like just Activity class for Actionbar. 它看起来就像Actionbar的Activity类。

I can't understand why it's unflexible to you to use ActionBarActivity, after all ActionBarActivity derives from Activity ActionBarActivity派生自Activity之后,我无法理解为什么使用ActionBarActivity不灵活

And if I'm not mistaken you must derive from ActionBarActivity in order to use toolbar and all the menu, title etc stuff that was formerly used by the ActionBar itself. 如果我没弄错的话,你必须从ActionBarActivity派生出来,以便使用工具栏以及ActionBar本身以前使用的所有菜单,标题等东西。

That told, I think the theming part is ok, using Toolbar rather than ActionBar is also ok, the only part I don't agree with is the Activity instead of the ActionBar Activity. 那告诉我,我认为主题部分没问题,使用工具栏而不是ActionBar也没关系,我唯一不同意的部分是Activity而不是ActionBar Activity。

Hope it helps ! 希望能帮助到你 !

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

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