本文整理汇总了Java中android.view.View.bringToFront方法的典型用法代码示例。如果您正苦于以下问题:Java View.bringToFront方法的具体用法?Java View.bringToFront怎么用?Java View.bringToFront使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.bringToFront方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onFocusChange
import android.view.View; //导入方法依赖的package包/类
@Override
public void onFocusChange(View v, boolean hasFocus) {
int focus = 0;
if (hasFocus) {
focus = R.anim.enlarge;
} else {
focus = R.anim.decrease;
}
// 如果有焦点就放大,没有焦点就缩小
Animation mAnimation = AnimationUtils.loadAnimation(
mContext, focus);
mAnimation.setBackgroundColor(Color.TRANSPARENT);
mAnimation.setFillAfter(hasFocus);
v.startAnimation(mAnimation);
mAnimation.start();
v.bringToFront();
}
示例2: reactionToClickSearchAction
import android.view.View; //导入方法依赖的package包/类
/**
* 点击搜索
*/
protected void reactionToClickSearchAction() {
mShowSearchToolbar = true;
View childView = mRevealFrameLayout.getChildAt(0);
childView.setVisibility(View.VISIBLE);
childView.bringToFront();
int centerX = childView.getRight();
int centerY = childView.getBottom() / 2;
Animator circularReveal = ViewAnimationUtils.createCircularReveal(childView, centerX, centerY, 0, childView.getWidth());
circularReveal.setDuration(300).setInterpolator(new LinearInterpolator());
circularReveal.start();
circularReveal.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
reactionToCover(true);
mEdSearch.requestFocus();
KeyboardUtils.showSoftInput(mEdSearch, getContext());
}
});
}
示例3: handleHeader
import android.view.View; //导入方法依赖的package包/类
/**
* Handles the header view.
*/
private void handleHeader() {
if (mHeaderViewId == DEFAULT_LAYOUT_ATTRIBUTE_VALUE || mMenuViewHolder.mMenuHeader == null) {
return;
}
View view = mLayoutInflater.inflate(mHeaderViewId, null, false);
if (view != null) {
if (mMenuViewHolder.mMenuHeader.getChildCount() > 0) {
mMenuViewHolder.mMenuHeader.removeAllViews();
}
mMenuViewHolder.mMenuHeader.addView(view);
view.setTag(TAG_HEADER);
view.bringToFront();
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mOnMenuClickListener != null) {
mOnMenuClickListener.onHeaderClicked();
}
}
});
}
}
示例4: onFocusChange
import android.view.View; //导入方法依赖的package包/类
@Override
public void onFocusChange(View v, boolean hasFocus) {
int focus = 0;
if (hasFocus) {
focus = R.anim.enlarge;
} else {
focus = R.anim.decrease;
}
//如果有焦点就放大,没有焦点就缩小
Animation mAnimation = AnimationUtils.loadAnimation(
getActivity().getApplication(), focus);
mAnimation.setBackgroundColor(Color.TRANSPARENT);
mAnimation.setFillAfter(hasFocus);
v.startAnimation(mAnimation);
mAnimation.start();
v.bringToFront();
}
示例5: applyWindowSize
import android.view.View; //导入方法依赖的package包/类
private void applyWindowSize() {
int n = mContainer.getChildCount();
View[] children = new View[n];
for (int i = 0; i < n; i++) {
children[i] = mContainer.getChildAt(i);
}
Arrays.sort(children, new Comparator<View>() {
@Override
public int compare(final View v1, final View v2) {
Window w1 = (Window) v1.getTag();
Window w2 = (Window) v2.getTag();
return w1.getZ_index() - w2.getZ_index();
}
});
for (View child : children) {
Window window = (Window) child.getTag();
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) child.getLayoutParams();
params.width = getSize(mContainerWidth, window.getWidth());
params.height = getSize(mContainerHeight, window.getHeight());
params.leftMargin = getSize(mContainerWidth, window.getLeft());
params.topMargin = getSize(mContainerHeight, window.getTop());
child.setLayoutParams(params);
child.bringToFront();
}
}
示例6: updateSnackbar
import android.view.View; //导入方法依赖的package包/类
@Override
public void updateSnackbar(CoordinatorLayout parent, View dependency, View child) {
if (dependency instanceof Snackbar.SnackbarLayout) {
if (mSnackbarHeight == -1) {
mSnackbarHeight = dependency.getHeight();
}
int targetPadding = child.getMeasuredHeight();
int shadow = (int) ViewCompat.getElevation(child);
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) dependency.getLayoutParams();
layoutParams.bottomMargin = targetPadding - shadow;
child.bringToFront();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
child.getParent().requestLayout();
((View) child.getParent()).invalidate();
}
}
}
示例7: updateSnackbar
import android.view.View; //导入方法依赖的package包/类
@Override
public void updateSnackbar(CoordinatorLayout parent, View dependency, View child) {
if (!isTablet && dependency instanceof Snackbar.SnackbarLayout) {
if (mSnackbarHeight == -1) {
mSnackbarHeight = dependency.getHeight();
}
if (ViewCompat.getTranslationY(child) != 0) return;
int targetPadding = bottomNavHeight + mSnackbarHeight - defaultOffset;
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) dependency.getLayoutParams();
layoutParams.bottomMargin = targetPadding;
child.bringToFront();
child.getParent().requestLayout();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
((View) child.getParent()).invalidate();
}
}
}
示例8: reactionToSearchBack
import android.view.View; //导入方法依赖的package包/类
/**
* 搜索栏的回退逻辑
*
* @return
*/
private boolean reactionToSearchBack() {
if (mShowSearchToolbar) {
mShowSearchToolbar = false;
KeyboardUtils.hideSoftInput(mEdSearch, getContext());
View childView = mRevealFrameLayout.getChildAt(0);
childView.bringToFront();
int centerX = childView.getLeft();
int centerY = childView.getBottom() / 2;
Animator circularReveal = ViewAnimationUtils.createCircularReveal(childView, centerX, centerY, 0, childView.getWidth());
circularReveal.setDuration(300).setInterpolator(new DecelerateInterpolator());
circularReveal.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
reactionToCover(false);
}
});
circularReveal.start();
if (mEdSearch != null) {
mEdSearch.setText("");
mSearchWord = "";
fetchSearchData(mSearchWord);
}
return true;
}
return false;
}
示例9: bringToFront
import android.view.View; //导入方法依赖的package包/类
/**
* bring a view to front
*
* @return
*/
public UDView bringToFront() {
final View view = getView();
if (view != null) {
view.bringToFront();
}
return this;
}
示例10: setTargetOffsetTopAndBottom
import android.view.View; //导入方法依赖的package包/类
private void setTargetOffsetTopAndBottom(View target, int offset, boolean requiresUpdate) {
target.bringToFront();
//Log.e(TAG, "setTargetOffsetTopAndBottom>>target.getTop="+target.getTop());
target.offsetTopAndBottom(offset);
// Log.e(TAG,"setTargetOffsetTopAndBottom>>bCircleView,offset="+offset+",top="+target.getTop());
bCurrentTargetOffsetTop = target.getTop();
if (requiresUpdate && android.os.Build.VERSION.SDK_INT < 11) {
invalidate();
}
}
示例11: showSticky
import android.view.View; //导入方法依赖的package包/类
/**
* Bring component with bigest pos to Front
*/
private void showSticky() {
if(mCurrentStickyRef==null){
WXLogUtils.e("Current Sticky ref is null.");
return;
}
WXCell headComponent = mHeaderComps.get(mCurrentStickyRef);
final View headerView = headComponent.getRealView();
if (headerView == null) {
WXLogUtils.e("Sticky header's real view is null.");
return;
}
View header = mHeaderViews.get(headComponent.getRef());
if( header != null){
//already there
header.bringToFront();
}else {
mHeaderViews.put(headComponent.getRef(), headerView);
//record translation, it should not change after transformation
final float translationX = headerView.getTranslationX();
final float translationY = headerView.getTranslationY();
headComponent.removeSticky();
ViewGroup existedParent;
if ((existedParent = (ViewGroup) headerView.getParent()) != null) {
existedParent.removeView(headerView);
}
mParent.addView(headerView);
//recover translation, sometimes it will be changed on fling
headerView.setTranslationX(translationX);
headerView.setTranslationY(translationY);
}
if (headComponent.getDomObject().getEvents().contains("sticky")) {
headComponent.fireEvent("sticky");
}
}
示例12: animateStack
import android.view.View; //导入方法依赖的package包/类
protected void animateStack(View left, View right, float positionOffset, int positionOffsetPixels) {
if (mState != State.IDLE) {
if (right != null) {
manageLayer(right, true);
mScale = (1-SCALE_MAX) * positionOffset + SCALE_MAX;
mTrans = -getWidth()-getPageMargin()+positionOffsetPixels;
ViewHelper.setScaleX(right, mScale);
ViewHelper.setScaleY(right, mScale);
ViewHelper.setTranslationX(right, mTrans);
}
if (left != null) {
left.bringToFront();
}
}
}
示例13: setTranslationZ
import android.view.View; //导入方法依赖的package包/类
public static void setTranslationZ(View view, float translationZ) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ViewCompat.setTranslationZ(view, translationZ);
} else if (translationZ != 0) {
view.bringToFront();
if (view.getParent() != null) {
((View) view.getParent()).invalidate();
}
}
}
示例14: onCreate
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.inventory);
TextView main = (TextView) findViewById(R.id.maininventory);
View mainButton = findViewById(R.id.main_button);
mainButton.setOnClickListener(this);
mainButton.bringToFront();
ArrayList<Transaction> transactions = new ArrayList<>(db.getAllTransactions());
for(Transaction transaction: transactions){
if(transaction.getTypeNumber()==1||transaction.getTypeNumber()==2) {
main.append("\n\nTransaction Number: " + transaction.getId());
main.append("\n Reservation Number: " + transaction.getReservation());
main.append("\n Username: " + transaction.getUsername());
main.append("\n Transaction Type: " + transaction.getType());
main.append("\n Book Title: " + transaction.getTitle());
main.append("\n Pick Up: " + transaction.getPickUpDate());
main.append("\n Return: " + transaction.getDropOffDate());
main.append("\n Transaction Date: " + transaction.getDate());
main.append("\n Transaction Time: " + transaction.getTime());
}
else{
main.append("\n\nTransaction Number: " + transaction.getId());
main.append("\n Username: " + transaction.getUsername());
main.append("\n Transaction Type: " + transaction.getType());
main.append("\n Transaction Date: " + transaction.getDate());
main.append("\n Transaction Time: " + transaction.getTime());
}
}
db.getAllBooks();
}
示例15: refreshHeaderRowViewHolder
import android.view.View; //导入方法依赖的package包/类
/**
* Refresh current row header view holder.
*
* @param holder current view holder
*/
private void refreshHeaderRowViewHolder(ViewHolder holder) {
int top = mManager.getRowsHeight(0, Math.max(0, holder.getRowIndex())) + mManager.getHeaderColumnHeight();
int left = calculateRowHeadersLeft();
if (isRTL()) {
left += mSettings.getCellMargin();
}
View view = holder.getItemView();
int leftMargin = holder.getColumnIndex() * mSettings.getCellMargin() + mSettings.getCellMargin();
int topMargin = holder.getRowIndex() * mSettings.getCellMargin() + mSettings.getCellMargin();
if (holder.isDragging() && mDragAndDropPoints.getOffset().y > 0) {
top = mState.getScrollY() + mDragAndDropPoints.getOffset().y - view.getHeight() / 2;
view.bringToFront();
}
if (holder.isDragging()) {
View topShadow = mShadowHelper.getTopShadow();
View bottomShadow = mShadowHelper.getBottomShadow();
if (topShadow != null) {
int shadowTop = top - mState.getScrollY();
topShadow.layout(0,
Math.max(mManager.getHeaderColumnHeight() - mState.getScrollY(), shadowTop - SHADOW_THICK) + topMargin,
mSettings.getLayoutWidth(),
shadowTop + topMargin);
topShadow.bringToFront();
}
if (bottomShadow != null) {
int shadowBottom = top - mState.getScrollY() + mManager.getRowHeight(holder.getRowIndex());
bottomShadow.layout(
0,
Math.max(mManager.getHeaderColumnHeight() - mState.getScrollY(), shadowBottom) + topMargin,
mSettings.getLayoutWidth(),
shadowBottom + SHADOW_THICK + topMargin);
bottomShadow.bringToFront();
}
}
//noinspection ResourceType
view.layout(left + leftMargin * (isRTL() ? 0 : 1),
top - mState.getScrollY() + topMargin,
left + mManager.getHeaderRowWidth() + leftMargin * (isRTL() ? 1 : 0),
top + mManager.getRowHeight(holder.getRowIndex()) - mState.getScrollY() + topMargin);
if (mState.isColumnDragging()) {
view.bringToFront();
}
if (!mState.isRowDragging()) {
View shadow = mShadowHelper.getRowsHeadersShadow();
if (shadow == null) {
shadow = mShadowHelper.addRowsHeadersShadow(this);
}
int shadowStart, shadowEnd;
shadowStart = !isRTL() ? view.getRight() : view.getLeft() - SHADOW_HEADERS_THICK;
shadowEnd = shadowStart + SHADOW_HEADERS_THICK;
shadow.layout(shadowStart,
mState.isColumnDragging() ? 0 :
mSettings.isHeaderFixed() ? 0 : -mState.getScrollY(),
shadowEnd,
mSettings.getLayoutHeight());
shadow.bringToFront();
}
}