当前位置: 首页>>代码示例>>Java>>正文


Java LinearLayout.VERTICAL属性代码示例

本文整理汇总了Java中android.widget.LinearLayout.VERTICAL属性的典型用法代码示例。如果您正苦于以下问题:Java LinearLayout.VERTICAL属性的具体用法?Java LinearLayout.VERTICAL怎么用?Java LinearLayout.VERTICAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.widget.LinearLayout的用法示例。


在下文中一共展示了LinearLayout.VERTICAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getClipRectForHeader

/**
 * Gets a clipping rect for the header based on the margins of the header and the padding of the
 * recycler.
 * FIXME: Currently right margin in VERTICAL orientation and bottom margin in HORIZONTAL
 * orientation are clipped so they look accurate, but the headers are not being drawn at the
 * correctly smaller width and height respectively.
 *
 * @param recyclerView for which to provide a header
 * @param header       for clipping
 * @return a {@link Rect} for clipping a provided header to the padding of a recycler view
 */
private Rect getClipRectForHeader(RecyclerView recyclerView, View header) {
  Rect headerMargins = mDimensionCalculator.getMargins(header);
  if (mOrientationProvider.getOrientation(recyclerView) == LinearLayout.VERTICAL) {
    return new Rect(
        recyclerView.getPaddingLeft(),
        recyclerView.getPaddingTop(),
        recyclerView.getWidth() - recyclerView.getPaddingRight() - headerMargins.right,
        recyclerView.getHeight() - recyclerView.getPaddingBottom());
  } else {
    return new Rect(
        recyclerView.getPaddingLeft(),
        recyclerView.getPaddingTop(),
        recyclerView.getWidth() - recyclerView.getPaddingRight(),
        recyclerView.getHeight() - recyclerView.getPaddingBottom() - headerMargins.bottom);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:HeaderRenderer.java

示例2: initClipRectForHeader

/**
 * Initializes a clipping rect for the header based on the margins of the header and the padding of the
 * recycler.
 * FIXME: Currently right margin in VERTICAL orientation and bottom margin in HORIZONTAL
 * orientation are clipped so they look accurate, but the headers are not being drawn at the
 * correctly smaller width and height respectively.
 *
 * @param clipRect     {@link Rect} for clipping a provided header to the padding of a recycler view
 * @param recyclerView for which to provide a header
 * @param header       for clipping
 */
private void initClipRectForHeader(Rect clipRect, RecyclerView recyclerView, View header) {
    mDimensionCalculator.initMargins(clipRect, header);
    if (mOrientationProvider.getOrientation(recyclerView) == LinearLayout.VERTICAL) {
        clipRect.set(
                recyclerView.getPaddingLeft(),
                recyclerView.getPaddingTop(),
                recyclerView.getWidth() - recyclerView.getPaddingRight() - clipRect.right,
                recyclerView.getHeight() - recyclerView.getPaddingBottom());
    } else {
        clipRect.set(
                recyclerView.getPaddingLeft(),
                recyclerView.getPaddingTop(),
                recyclerView.getWidth() - recyclerView.getPaddingRight(),
                recyclerView.getHeight() - recyclerView.getPaddingBottom() - clipRect.bottom);
    }
}
 
开发者ID:sswukang,项目名称:RvAdapter,代码行数:27,代码来源:HeaderRenderer.java

示例3: DialerCallBar

public DialerCallBar(Context context, AttributeSet attrs, int style) {
    super(context, attrs);
    LayoutInflater inflater = LayoutInflater.from(context);
    inflater.inflate(R.layout.dialpad_additional_buttons, this, true);
    findViewById(R.id.dialVideoButton).setOnClickListener(this);
    findViewById(R.id.dialButton).setOnClickListener(this);
    findViewById(R.id.deleteButton).setOnClickListener(this);
    findViewById(R.id.deleteButton).setOnLongClickListener(this);
    
    if(getOrientation() == LinearLayout.VERTICAL) {
        LayoutParams lp;
        for(int i=0; i < getChildCount(); i++) {
            lp = (LayoutParams) getChildAt(i).getLayoutParams();
            int w = lp.width;
            lp.width = lp.height;
            lp.height = w;
            lp.gravity = Gravity.CENTER_HORIZONTAL;
            // Added for clarity but not necessary
            getChildAt(i).setLayoutParams(lp);
            
        }
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:23,代码来源:DialerCallBar.java

示例4: initClipRectForHeader

/**
 * Initializes a clipping rect for the header based on the margins of the header and the padding of the
 * recycler.
 * FIXME: Currently right margin in VERTICAL orientation and bottom margin in HORIZONTAL
 * orientation are clipped so they look accurate, but the headers are not being drawn at the
 * correctly smaller width and height respectively.
 *
 * @param clipRect {@link Rect} for clipping a provided header to the padding of a recycler view
 * @param recyclerView for which to provide a header
 * @param header       for clipping
 */
private void initClipRectForHeader(Rect clipRect, RecyclerView recyclerView, View header) {
  mDimensionCalculator.initMargins(clipRect, header);
  if (mOrientationProvider.getOrientation(recyclerView) == LinearLayout.VERTICAL) {
    clipRect.set(
        recyclerView.getPaddingLeft(),
        recyclerView.getPaddingTop(),
        recyclerView.getWidth() - recyclerView.getPaddingRight() - clipRect.right,
        recyclerView.getHeight() - recyclerView.getPaddingBottom());
  } else {
      clipRect.set(
        recyclerView.getPaddingLeft(),
        recyclerView.getPaddingTop(),
        recyclerView.getWidth() - recyclerView.getPaddingRight(),
        recyclerView.getHeight() - recyclerView.getPaddingBottom() - clipRect.bottom);
  }
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:27,代码来源:HeaderRenderer.java

示例5: dispatchTouchEvent

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
    float offset = event.getX();
    if (mOrientation == LinearLayout.VERTICAL) {
        offset = event.getY();
    }
    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
        case MotionEvent.ACTION_MOVE:
            setCurrentValueByLocation(offset);
            return true;
        case MotionEvent.ACTION_UP:
            onValueDone();
            break;
    }
    return super.dispatchTouchEvent(event);
}
 
开发者ID:chenshi011,项目名称:PointSeekBar,代码行数:17,代码来源:PointSeekBar.java

示例6: initView

private void initView()
{
    startTime = (TextView) findViewById(R.id.plan_time_txt_start);
    stopTime = (TextView) findViewById(R.id.plan_time_txt_stop);

    recycler = (RecyclerView) findViewById(R.id.plan_time_calender);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayout.VERTICAL, false);
    recycler.setLayoutManager(layoutManager);
}
 
开发者ID:z13538657403,项目名称:CalendarChoose,代码行数:9,代码来源:MonthTimeActivity.java

示例7: hasStickyHeader

/**
 * Determines if a view should have a sticky header.
 * The view has a sticky header if:
 * 1. It is the first element in the recycler view
 * 2. It has a valid ID associated to its position
 *
 * @param itemView    given by the RecyclerView
 * @param orientation of the Recyclerview
 * @param position    of the list item in question
 * @return True if the view should have a sticky header
 */
public boolean hasStickyHeader(View itemView, int orientation, int position) {
    int offset, margin;
    mDimensionCalculator.initMargins(mTempRect1, itemView);
    if (orientation == LinearLayout.VERTICAL) {
        offset = itemView.getTop();
        margin = mTempRect1.top;
    } else {
        offset = itemView.getLeft();
        margin = mTempRect1.left;
    }

    return offset <= margin && mAdapter.getHeaderId(position) >= 0;
}
 
开发者ID:sswukang,项目名称:RvAdapter,代码行数:24,代码来源:HeaderPositionCalculator.java

示例8: hasStickyHeader

/**
 * Determines if a view should have a sticky header.
 * The view has a sticky header if:
 * 1. It is the first element in the recycler view
 * 2. It has a valid ID associated to its position
 *
 * @param itemView    given by the RecyclerView
 * @param orientation of the RecyclerView
 * @param position    of the list item in question
 * @return True if the view should have a sticky header
 */
boolean hasStickyHeader(View itemView, int orientation, int position) {
    int offset, margin;
    mDimensionCalculator.initMargins(mTempRect1, itemView);
    if (orientation == LinearLayout.VERTICAL) {
        offset = itemView.getTop();
        margin = mTempRect1.top;
    } else {
        offset = itemView.getLeft();
        margin = mTempRect1.left;
    }

    return offset <= margin && mAdapter.getHeaderId(position) >= 0;
}
 
开发者ID:YunzhanghuOpen,项目名称:redpacketui-open,代码行数:24,代码来源:HeaderPositionCalculator.java

示例9: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_repo);
    mRecyclerView = (RecyclerView) findViewById(R.id.rv_repositories);
    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
            LinearLayout.VERTICAL);
    mRecyclerView.addItemDecoration(dividerItemDecoration);
    RepositoryPresenter repositoryPresenter = new RepositoryPresenter(this);
    repositoryPresenter.getRepositories(AndroidSchedulers.mainThread(), Schedulers.newThread());
}
 
开发者ID:SnowdogApps,项目名称:MoeSampleApp,代码行数:13,代码来源:RepositoryActivity.java

示例10: hasStickyHeader

/**
 * Determines if a view should have a sticky header.
 * The view has a sticky header if:
 * 1. It is the first element in the recycler view
 * 2. It has a valid ID associated to its position
 *
 * @param itemView given by the RecyclerView
 * @param orientation of the Recyclerview
 * @param position of the list item in question
 * @return True if the view should have a sticky header
 */
public boolean hasStickyHeader(View itemView, int orientation, int position) {
  int offset, margin;
  mDimensionCalculator.initMargins(mTempRect1, itemView);
  if (orientation == LinearLayout.VERTICAL) {
    offset = itemView.getTop();
    margin = mTempRect1.top;
  } else {
    offset = itemView.getLeft();
    margin = mTempRect1.left;
  }

  return offset <= margin && mAdapter.getHeaderId(position) >= 0;
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:24,代码来源:HeaderPositionCalculator.java

示例11: setOrientation

@Override
    public void setOrientation(int orientation) {
        if (LinearLayout.HORIZONTAL == orientation) {
//            throw new IllegalArgumentException("ExpandTextView only supports Vertical Orientation.");
            //强制使用垂直布局
            super.setOrientation(LinearLayout.VERTICAL);
        }
        super.setOrientation(orientation);
    }
 
开发者ID:yhyzgn,项目名称:Widgets,代码行数:9,代码来源:ExpandTextView.java

示例12: setOrientation

@Override
public void setOrientation(int orientation) {
    if (LinearLayout.VERTICAL != orientation) {
        throw new IllegalArgumentException("This class only supports VERTICAL orientation.");
    }

    // Only support vertical orientation
    super.setOrientation(orientation);
}
 
开发者ID:103style,项目名称:RefreshWithAppBarLayout,代码行数:9,代码来源:PullToRefreshBase.java

示例13: RViewPager

public RViewPager(Context context, AttributeSet attrs) {
    super(context, attrs);
    if (mOrientation == LinearLayout.HORIZONTAL) {
        setPageTransformer(true, new FadeInOutPageTransformer());
    } else {
        setPageTransformer(true, new DefaultVerticalTransformer());
    }
    mGestureDetectorCompat = new GestureDetectorCompat(context, new GestureDetector.SimpleOnGestureListener() {

        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            if (mOnPagerEndListener != null &&
                    getAdapter() != null &&
                    getCurrentItem() == getAdapter().getCount() - 1) {
                if (mOrientation == LinearLayout.VERTICAL) {
                    if (velocityY < -1000) {
                        mOnPagerEndListener.onPagerEnd();
                    }
                } else {
                    if (velocityX < -1000) {
                        mOnPagerEndListener.onPagerEnd();
                    }
                }
            }
            return super.onFling(e1, e2, velocityX, velocityY);
        }
    });
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:28,代码来源:RViewPager.java

示例14: onTouchEvent

@Override
public boolean onTouchEvent(MotionEvent ev) {
    try {
        if (mOrientation == LinearLayout.VERTICAL) {
            return mGestureDetectorCompat.onTouchEvent(ev)
                    || super.onTouchEvent(swapTouchEvent(ev));
        }
        return mGestureDetectorCompat.onTouchEvent(ev)
                || super.onTouchEvent(ev);
    } catch (IllegalArgumentException ex) {
        ex.printStackTrace();
    }
    return false;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:14,代码来源:RViewPager.java

示例15: onInterceptTouchEvent

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    try {
        if (mOrientation == LinearLayout.VERTICAL) {
            return super.onInterceptTouchEvent(swapTouchEvent(ev));
        }
        return super.onInterceptTouchEvent(ev);
    } catch (IllegalArgumentException ex) {
        ex.printStackTrace();
    }
    return false;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:12,代码来源:RViewPager.java


注:本文中的android.widget.LinearLayout.VERTICAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。