Android AT_MOST hack - 它是如何工作的?

时间:2013-08-07 16:30:39

标签: android measurement

我在这个问题中找到了我的问题的答案:android How to stretch rows in the gridview to fill screen?

确实我不明白以下是如何工作的:

@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
    // HACK! TAKE THAT ANDROID!
    if (isExpanded())
    {
        // Calculate entire height by providing a very large height hint.
        // But do not use the highest 2 bits of this integer; those are
        // reserved for the MeasureSpec mode.
        int expandSpec = MeasureSpec.makeMeasureSpec(
                Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, expandSpec);

是否有某处解释,为什么移位的位,以及AT_MOST如何工作? 不应该有最大大小值和AT_MOST标志吗?

0 个答案:

没有答案