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


Java ViewCompat.setTranslationZ方法代码示例

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


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

示例1: initView

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void initView() {
    inflate(getContext(), R.layout.alerter_alert_view, this);
    setHapticFeedbackEnabled(true);

    ViewCompat.setTranslationZ(this, Integer.MAX_VALUE);

    flBackground = (FrameLayout) findViewById(R.id.flAlertBackground);
    flClickShield = (FrameLayout) findViewById(R.id.flClickShield);
    ivIcon = (ImageView) findViewById(R.id.ivIcon);
    tvTitle = (TextView) findViewById(R.id.tvTitle);
    tvText = (TextView) findViewById(R.id.tvText);
    rlContainer = (ViewGroup) findViewById(R.id.rlContainer);
    pbProgress = (ProgressBar) findViewById(R.id.pbProgress);

    flBackground.setOnClickListener(this);

    //Setup Enter & Exit Animations
    slideInAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.alerter_slide_in_from_top);
    slideOutAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.alerter_slide_out_to_top);
    slideInAnimation.setAnimationListener(this);

    //Set Animation to be Run when View is added to Window
    setAnimation(slideInAnimation);
}
 
开发者ID:Tapadoo,项目名称:Alerter,代码行数:25,代码来源:Alert.java

示例2: setTranslationZ

import android.support.v4.view.ViewCompat; //导入方法依赖的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();
        }
    }
}
 
开发者ID:amarjain07,项目名称:StickyScrollView,代码行数:11,代码来源:PropertySetter.java

示例3: resetLongPressView

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void resetLongPressView() {
    longPressDraging = false;
    mView.scrollTo(0, 0);
    mView.setTranslationY(0);
    ViewCompat.setTranslationZ(mView, 0);
    mView.setBackground(null);
    mView.setPadding(0, 0, 0, 0);
    if (mLastTargetView != null) {
        mLastTargetView.setBackground(null);
        mLastTargetView.setPadding(0, 0, 0, 0);
        mLastTargetView = null;
    }
    mView.setScaleX(1f);
    mView.setScaleY(1f);
    mView = null;
    leftMarginWidth = 0;
    rightMarginWidth = 0;
    mLeftViewWidthList.clear();
    mRightViewWidthList.clear();
}
 
开发者ID:qinhehu,项目名称:Gesture,代码行数:21,代码来源:ItemTouchListener.java

示例4: initViews

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void initViews() {
    toolbar.setTitle("");
    setSupportActionBar(toolbar);
    logo.bringToFront();
    logo.requestLayout();
    logo.invalidate();

    InputFilter[] filters = new InputFilter[1];
    filters[0] = new InputFilter() {
        @Override
        public CharSequence filter(CharSequence source, int start,
                                   int end, Spanned dest, int dstart, int dend) {
            if (end > start) {
                String destTxt = dest.toString();
                String resultingTxt = destTxt.substring(0, dstart) +
                        source.subSequence(start, end) +
                        destTxt.substring(dend);
                if (!resultingTxt.matches("^\\d{1,3}(\\." +
                        "(\\d{1,3}(\\.(\\d{1,3}(\\.(\\d{1,3})?)?)?)?)?)?")) {
                    return "";
                } else {
                    String[] splits = resultingTxt.split("\\.");
                    for (int i = 0; i < splits.length; i++) {
                        if (Integer.valueOf(splits[i]) > 255) {
                            return "";
                        }
                    }
                }
            }
            return null;
        }
    };
    firstDnsEdit.setFilters(filters);
    secondDnsEdit.setFilters(filters);
    ViewCompat.setTranslationZ(logo, 8);
}
 
开发者ID:msayan,项目名称:star-dns-changer,代码行数:37,代码来源:MainActivity.java

示例5: goVideoActivity

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void goVideoActivity(View view) {
//        Intent intent = new Intent(this, VideoActivity.class);
//        startActivity(intent);

        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams
                (RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
        youtubePlayerViewGroup = new YoutubePlayerViewGroup(this);
        youtubePlayerViewGroup.setLayoutParams(layoutParams);
        youtubePlayerViewGroup.setContextInstance(this, getSupportFragmentManager());
        youtubePlayerViewGroup.addSlidingViewGroup();
        youtubePlayerViewGroup.setSlidingListener(new SlidingListener() {
            @Override
            public void onMaximized() {
                youtubePlayerViewGroup.playVideo();
            }

            @Override
            public void onMinimized() {
            }

            @Override
            public void onClosedToLeft() {
                youtubePlayerViewGroup.pauseVideo();
                removeYoutubePlayerViewGruop();
            }

            @Override
            public void onClosedToRight() {
                youtubePlayerViewGroup.pauseVideo();
                removeYoutubePlayerViewGruop();
            }
        });
        relativeLayout.addView(youtubePlayerViewGroup);

        ViewCompat.setTranslationZ(youtubePlayerViewGroup, 100);
    }
 
开发者ID:mugku,项目名称:slidingplayersampleapp,代码行数:37,代码来源:MainActivity.java

示例6: show

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void show(RelativeLayout parentView) {
    if(!isShowing && parentView != null) {
        this.parentView = parentView;
        this.parentView.addView(blankView, 0);
        this.blankView.bringToFront();
        this.parentView.requestLayout();
        this.parentView.invalidate();
        ViewCompat.setTranslationZ(blankView, 99);
        this.isShowing = true;
    }
}
 
开发者ID:battleent,项目名称:android-BlankSpace,代码行数:12,代码来源:BlankSpace.java

示例7: SwipeDeck

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public SwipeDeck(final Context context, AttributeSet attrs) {
    super(context, attrs);

    TypedArray a = context.getTheme().obtainStyledAttributes(
            attrs,
            R.styleable.SwipeDeck2,
            0, 0);
    NUMBER_OF_SIMULTANEOUS_CARDS = a.getInt(R.styleable.SwipeDeck2_max_visible, 3);
    OPACITY_END = a.getFloat(R.styleable.SwipeDeck2_opacity_end, 0.33f);
    ROTATION_DEGREES = a.getFloat(R.styleable.SwipeDeck2_rotation_degrees, 15f);
    CARD_SPACING = a.getDimension(R.styleable.SwipeDeck2_card_spacing, 15f);
    RENDER_ABOVE = a.getBoolean(R.styleable.SwipeDeck2_render_above, true);
    SWIPE_ENABLED = a.getBoolean(R.styleable.SwipeDeck2_swipe_enabled, true);
    previewLayoutId = a.getResourceId(R.styleable.SwipeDeck2_preview_layout, -1);

    deck = new Deck<>(new Deck.DeckEventListener() {

        @Override
        public void itemAddedFront(Object item) {
            deck.getFront().setSwipeEnabled(true);
            if (deck.size() > NUMBER_OF_SIMULTANEOUS_CARDS) {
                deck.removeBack();
                adapterIndex--;
            }
            renderDeck();
        }

        @Override
        public void itemAddedBack(Object item) {
            deck.getFront().setSwipeEnabled(true);
            renderDeck();
        }

        @Override
        public void itemRemovedFront(Object item) {
            CardContainer container = (CardContainer) item;
            buffer.add(container);
            //enable swipe in the next cardContainer
            if (deck.size() > 0) {
                deck.getFront().setSwipeEnabled(true);
            }
            container.cleanupAndRemoveView();
            //pull in the next view (if available)
            addNextView();
            renderDeck();
        }

        @Override
        public void itemRemovedBack(Object item) {
            ((CardContainer) item).getCard().animate().setDuration(100).alpha(0);
        }
    });

    //set clipping of view parent to false so cards render outside their view boundary
    //make sure not to clip to padding
    setClipToPadding(false);
    setClipChildren(false);
    this.setWillNotDraw(false);

    //if render above is set make sure everything in this view renders above other views
    //outside of it.
    if (RENDER_ABOVE) {
        ViewCompat.setTranslationZ(this, Float.MAX_VALUE);
    }//todo: make an else here possibly
}
 
开发者ID:pao11,项目名称:SwipeDeckRelease,代码行数:66,代码来源:SwipeDeck.java


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