本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
});
}
示例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;
}
示例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;
}