Search code examples
androidtitlebar

How to change title bar color without theme


How I can change background color of titlebar without using theme. tnks in Android.


Solution

  • Try with the following code

    View titleView = getWindow().findViewById(android.R.id.titlebar);
        if (titleView != null) {
          ViewParent parent = titleView.getParent();
          if (parent != null && (parent instanceof View)) {
            View parentView = (View)parent;
            parentView.setBackgroundColor(Color.RED);
          }
        }