Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Both the top and bottom action bar are the same height. As far as I know, you can not request the size of the action bar programmatically. <a href="https://stackoverflow.com/a/12304018/338724">This</a> post gives an example of how to set the action bar height with a style so that it is consistent. </p> <p>To determine whether or not the action bar has been split, you must calculate this manually. As per <a href="http://developer.android.com/design/patterns/actionbar.html" rel="nofollow noreferrer">the design guidelines</a> (near the bottom)</p> <blockquote> <p>How many actions will fit in the main action bar? Action bar capacity is controlled by the following rules:</p> <ul> <li>Action buttons in the main action bar may not occupy more than 50% of the bar's width. Action buttons on bottom action bars can use the entire width.</li> <li><p>The screen width in density-independent pixels (dp) determine the number of items that will fit in the main action bar:</p></li> <li><p>smaller than 360 dp = 2 icons</p></li> <li><p>360-499 dp = 3 icons</p></li> <li><p>500-599 dp = 4 icons</p></li> <li><p>600 dp and larger = 5 icons</p></li> </ul> </blockquote> <p>Example: <img src="https://i.stack.imgur.com/5dPx5.png" alt="table of examples"></p> <p>So you want to do something like this.</p> <pre><code>DisplayMetrics displayMetrics = new DisplayMetrics(); Display display = getWindowManager().getDefaultDisplay(); display.getMetrics(displayMetrics); float density = displayMetrics.density; // width in dp float width = (displayMetrics.widthPixels / density); // I will assume you have 3 action bar icons if (width &lt; 360) { // 2 menu items fit. // Calculate action bar height with 2*(actionbar height) // to accommodate the bottom action bar. } else { // 3+ menu items fit // Calculate action bar height with 1*(actionbar height). } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload