【问题标题】:Is there a theme for Holo, full screen but with Action Bar?Holo 是否有全屏主题但带有操作栏?
【发布时间】:2012-04-13 02:46:39
【问题描述】:

我需要显示一个活动,使活动保持全屏(无标题栏)但存在操作栏。

应用使用 Holo Light 作为其界面。

有这样的风格/主题吗?

【问题讨论】:

    标签: android android-theme


    【解决方案1】:

    我有同样的“问题”,我所做的基本上是老方法:

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    

    这与普通的Theme.Holo 结合使用会产生一个带有操作栏但没有通知区域的 UI。

    【讨论】:

    • 为什么这没有被标记为答案?完美解决问题
    • 我同意,这应该被标记为正确答案。
    • 为什么只限制 ONE UP VOTE,为什么,为什么?
    【解决方案2】:

    不幸的是,所有没有标题栏的内置 Holo Light 主题也没有操作栏。 Theme.Holo.Light.NoActionBar 有标题栏但没有操作栏,Theme.Holo.Light.NoActionBar.Fullscreen 既没有操作栏也没有标题栏。

    【讨论】:

    • 一个可能的选择是尝试非 Holo NoTitleBar 主题并使用新的 4.0 外观设计您的组件。不确定这是否也会删除操作栏。
    • 我现在正在考虑有一个自定义栏:|
    • 如何回答这个问题?
    • 查看@WarrenFaith 提供的答案,它实际上解决了问题!
    【解决方案3】:

    以下是您必须设置的内容:

        actionBar.setDisplayHomeAsUpEnabled(false);
        actionBar.setHomeButtonEnabled(false);
        actionBar.setDisplayUseLogoEnabled(false);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayShowHomeEnabled(false);
    

    祝你好运

    【讨论】:

    • 这不符合问题的要求。
    【解决方案4】:

    您可以创建一个继承 Holo Light 并移除标题栏的自定义主题。

    将以下内容添加到 res/values/styles.xml

    <style name="My.Holo.Light.FullScreen" parent="android:Theme.Holo.Light">
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>
    

    在清单 xml 中将此样式设置为应用程序的默认主题。

    【讨论】:

      【解决方案5】:

      试试这个(完整教程请参阅http://javatechig.com/android/actionbar-with-custom-view-example-in-android):

      private void actionBar() {
          // remove title
          //    requestWindowFeature(Window.FEATURE_NO_TITLE);
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
              WindowManager.LayoutParams.FLAG_FULLSCREEN);
      
          ActionBar actionBar = getActionBar();
          actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#bdbb35")));
          actionBar.show();
      
          actionBar.setDisplayShowHomeEnabled(false);
          actionBar.setDisplayShowTitleEnabled(false);
          LayoutInflater mInflater = LayoutInflater.from(this);
      
          View mCustomView = mInflater.inflate(R.layout.custom_actionbar, null);
      
          //TextView mTitleTextView = (TextView) mCustomView.findViewById(R.id.title_text);
          //  mTitleTextView.setText("My Own Title");
      
          actionBar.setCustomView(mCustomView);
          actionBar.setDisplayShowCustomEnabled(true);
      }
      

      【讨论】:

        【解决方案6】:

        只需使用 Theme.Holo 它是全屏并带有操作栏 :)

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多