How to set Actionbar height?

Asked

Viewed 267 times

0

I want to put the height of Actionbar as 80dp but the way I did it’s not working:

<style name="LargeActionBar" parent="Base.Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/primary</item>
        <item name="colorPrimaryDark">@color/primary_dark</item>
        <item name="colorAccent">@color/accent</item>
        <item name="actionBarStyle">@style/LargeActionBar.Large</item>
        <item name="android:actionBarStyle">@style/LargeActionBar.Large</item>
    </style>

    <style name="LargeActionBar.Large" parent="Base.Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="android:background">@color/primary</item>
        <item name="android:height">80dp</item>
        <item name="height">80dp</item>
        <item name="actionBarSize">80dp</item>
    </style>

Activity:

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_compra);

        Bundle args = getIntent().getExtras();
        if (args != null) {
            idLista = args.getString("nomeLista");
        }

        ActionBar actionBar = getSupportActionBar();
        setTheme(R.style.LargeActionBar);
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowTitleEnabled(false);
        LayoutInflater inflater = LayoutInflater.from(this);

        View customView = inflater.inflate(R.layout.layout_actionbar,null);

        actionBar.setCustomView(customView);
        actionBar.setDisplayShowCustomEnabled(true);
  • You are using Toolbar?

  • If you are, just define the height with the value you want in the view’s XML.

  • But I’m already doing it

  • https://developer.android.com/training/appbar/setting-up.html?hl=pt-br

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.