1

我在这个主题中找到了我的问题的答案: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 标志吗?

4

0 回答 0