Skip to content
Snippets Groups Projects
Commit 0e382005 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Fix action bar tabs collapsing when they shouldn't."

parents 2859e2b7 af6b97eb
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
/**
......@@ -109,7 +110,9 @@ public class ActionBarContainer extends FrameLayout {
mTabContainer = tabView;
if (tabView != null) {
addView(tabView);
tabView.getLayoutParams().width = LayoutParams.MATCH_PARENT;
final ViewGroup.LayoutParams lp = tabView.getLayoutParams();
lp.width = LayoutParams.MATCH_PARENT;
lp.height = LayoutParams.WRAP_CONTENT;
tabView.setAllowCollapse(false);
}
}
......
......@@ -68,6 +68,11 @@ public class ScrollingTabContainerView extends HorizontalScrollView
super(context);
setHorizontalScrollBarEnabled(false);
TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.ActionBar,
com.android.internal.R.attr.actionBarStyle, 0);
setContentHeight(a.getLayoutDimension(R.styleable.ActionBar_height, 0));
a.recycle();
mTabLayout = createTabLayout();
addView(mTabLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.MATCH_PARENT));
......@@ -91,16 +96,7 @@ public class ScrollingTabContainerView extends HorizontalScrollView
mMaxTabWidth = -1;
}
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
if (heightMode != MeasureSpec.UNSPECIFIED) {
if (mContentHeight == 0 && heightMode == MeasureSpec.EXACTLY) {
// Use this as our content height.
mContentHeight = heightSize;
}
heightSize = Math.min(heightSize, mContentHeight);
heightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
}
heightMeasureSpec = MeasureSpec.makeMeasureSpec(mContentHeight, MeasureSpec.EXACTLY);
final boolean canCollapse = !lockedExpanded && mAllowCollapse;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment