android.widget.FrameLayout#LayoutParams ( )源码实例Demo

下面列出了android.widget.FrameLayout#LayoutParams ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tbs_file_view_layout);
    rootViewParent = (FrameLayout) findViewById(R.id.fl_rootview);
    errorHandleLayout = (ViewGroup) findViewById(R.id.ll_error_handle);
    initErrorHandleLayout(errorHandleLayout);

    filePath = handleIntent();
    if (TextUtils.isEmpty(filePath) || !new File(filePath).isFile()) {
        Toast.makeText(this, getString(R.string.file_not_exist), Toast.LENGTH_SHORT).show();
        finish();
    }

    getSupportActionBar().setTitle(getString(R.string.view_file) + getFileName(filePath));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    mTbsReaderView = new TbsReaderView(this, this);
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.MATCH_PARENT
    );
    mTbsReaderView.setLayoutParams(layoutParams);
    rootViewParent.addView(mTbsReaderView);
    displayFile(filePath);
}
 
源代码2 项目: PLDroidShortVideo   文件: VideoDivideActivity.java
private void addSelectorView() {
    mCurSelectorView = new FrameSelectorView(this);
    final FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, mFrameListParent.getHeight());
    mCurSelectorView.setVisibility(View.INVISIBLE);
    mScrollViewParent.addView(mCurSelectorView, layoutParams);

    mCurSelectorView.post(new Runnable() {
        @Override
        public void run() {
            // put mCurSelectorView to the middle of the horizontal
            layoutParams.leftMargin = (mScrollViewParent.getWidth() - mCurSelectorView.getWidth()) / 2;
            mCurSelectorView.setLayoutParams(layoutParams);
            mCurSelectorView.setVisibility(View.VISIBLE);
        }
    });
}
 
public CommonLayoutParams(CommonLayoutParams source) {
    this((FrameLayout.LayoutParams) source);

    this.widthPercent = source.widthPercent;
    this.heightPercent = source.heightPercent;

    this.topMargin = source.topMargin;
    this.leftMargin = source.leftMargin;
    this.bottomMargin = source.bottomMargin;
    this.rightMargin = source.rightMargin;

    this.left = source.left;
    this.top = source.top;
    this.row = source.row;
    this.column = source.column;
    this.rowSpan = source.rowSpan;
    this.columnSpan = source.columnSpan;
    this.dock = source.dock;
}
 
源代码4 项目: TvAppRepo   文件: BrowseErrorActivity.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    ProgressBar progressBar = new ProgressBar(container.getContext());
    if (container instanceof FrameLayout) {
        FrameLayout.LayoutParams layoutParams =
                new FrameLayout.LayoutParams(SPINNER_WIDTH, SPINNER_HEIGHT, Gravity.CENTER);
        progressBar.setLayoutParams(layoutParams);
    }
    return progressBar;
}
 
源代码5 项目: AOSP-Kayboard-7.1.2   文件: ViewLayoutUtils.java
public static MarginLayoutParams newLayoutParam(final ViewGroup placer, final int width,
        final int height) {
    if (placer instanceof FrameLayout) {
        return new FrameLayout.LayoutParams(width, height);
    } else if (placer instanceof RelativeLayout) {
        return new RelativeLayout.LayoutParams(width, height);
    } else if (placer == null) {
        throw new NullPointerException("placer is null");
    } else {
        throw new IllegalArgumentException("placer is neither FrameLayout nor RelativeLayout: "
                + placer.getClass().getName());
    }
}
 
源代码6 项目: BalloonPerformer   文件: LineView.java
private void addLine(int x, int y, int offsetX) {
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.WRAP_CONTENT,
            FrameLayout.LayoutParams.WRAP_CONTENT);
    mOriY = -mLineLength + y + ViewUtil.getStatusBarHeight(mContext);
    // 如果view没有被加入到某个父组件中,则加入WindowManager中
    if (this.getParent() == null) {
        mContainer.addView(this, lp);
        // ViewHelper.setTranslationY(this, mOriY);
        // ViewHelper.setTranslationX(this, x);
        updateByPos(x, y, offsetX);
    }
}
 
源代码7 项目: SweetTips   文件: SnackbarUtils.java
/**
 * 设置SweetSnackbar实例显示的位置
 * @param gravity
 */
public SnackbarUtils gravityFrameLayout(int gravity){
    if(getSnackbar()!=null){
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(getSnackbar().getView().getLayoutParams().width,getSnackbar().getView().getLayoutParams().height);
        params.gravity = gravity;
        getSnackbar().getView().setLayoutParams(params);
    }
    return this;
}
 
源代码8 项目: GravityBox   文件: ModClearAllRecents.java
@SuppressLint("RtlHardcoded")
private static void updateRamBarLayout() {
    if (mRamUsageBar == null || mRamBarGravity == 0) return;

    final Context context = mRamUsageBar.getContext();
    final Resources res = mRamUsageBar.getResources();
    final int orientation = res.getConfiguration().orientation;
    final boolean caOnTop = (mButtonGravity & Gravity.TOP) == Gravity.TOP;
    final boolean caOnLeft = (mButtonGravity & Gravity.LEFT) == Gravity.LEFT;
    final boolean rbOnTop = (mRamBarGravity == Gravity.TOP);
    final int marginTop = rbOnTop ? mMarginTopPx : 0;
    final int marginBottom = (!rbOnTop && (orientation == Configuration.ORIENTATION_PORTRAIT ||
            !Utils.isPhoneUI(context))) ? mMarginBottomPx : 0;
    final int marginLeft = orientation == Configuration.ORIENTATION_LANDSCAPE &&
            Utils.isPhoneUI(context) & mNavbarLeftHanded ? mMarginBottomPx : 0;
    final int marginRight = orientation == Configuration.ORIENTATION_LANDSCAPE &&
            Utils.isPhoneUI(context) & !mNavbarLeftHanded ? mMarginBottomPx : 0;

    FrameLayout.LayoutParams flp = (FrameLayout.LayoutParams) mRamUsageBar.getLayoutParams();
    flp.gravity = mRamBarGravity;
    flp.setMargins(mRamUsageBarHorizontalMargin + marginLeft,
            rbOnTop ? (mRamUsageBarVerticalMargin + marginTop) : 0,
            mRamUsageBarHorizontalMargin + marginRight,
            rbOnTop ? 0 : (mRamUsageBarVerticalMargin + marginBottom)
    );
    mRamUsageBar.setLayoutParams(flp);
    if (DEBUG) log("RAM bar layout updated");
}
 
源代码9 项目: letv   文件: AppbarActivity.java
private void createViews() {
    LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
    this.mWebView.setLayoutParams(layoutParams);
    this.mRootView = new LinearLayout(this);
    layoutParams.gravity = 17;
    this.mRootView.setLayoutParams(layoutParams);
    this.mRootView.setOrientation(1);
    this.mTitleBar = new TitleBar(this);
    this.mTitleBar.getBackBtn().setOnClickListener(this);
    this.mTitleBar.getSharBtn().setOnClickListener(this);
    this.mRootView.addView(this.mTitleBar);
    this.mRootView.addView(this.mWebView);
    setContentView(this.mRootView);
}
 
源代码10 项目: KJFrameForAndroid   文件: CurtainViewController.java
/**
 * 为控件做一些属性设置
 */
protected void prepareSlidingLayout() {
    curtainLayoutParams = (FrameLayout.LayoutParams) curtainParent
            .getLayoutParams();
    ViewTreeObserver vto = curtainParent.getViewTreeObserver();
    vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
        @Override
        @SuppressLint("NewApi")
        public void onGlobalLayout() {
            hideCurtainLayout();
            ViewTreeObserver obs = curtainParent.getViewTreeObserver();
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                obs.removeOnGlobalLayoutListener(this);
            } else {
                obs.removeGlobalOnLayoutListener(this);
            }
        }

    });

    curtainParent.setOnTouchListener(new OnContentTouchListener());

    curtainParent.setOnKeyListener(new OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK
                    && getSlidingStatus() == SlidingStatus.EXPANDED) {
                collapse();
                return true;
            } else {
                return false;
            }
        }
    });
}
 
源代码11 项目: TigerVideo   文件: VideoPlayerView.java
/**
 * 开始小窗口播放
 */
protected void onStartSmallWindowPlay() {

    mVideoControllerView.stopVideoProgressUpdate();
    setCurrentScreenState(ScreenState.SCREEN_STATE_SMALL_WINDOW);
    PlayerManager.getInstance().setTextureView(null);
    mVideoTextureViewContainer.removeAllViews();
    VideoPlayerView smallWindowView = new VideoPlayerView(getContext());
    smallWindowView.setId(R.id.vp_small_window_view_id);
    smallWindowView.mVideoControllerView.cloneState(mVideoControllerView);
    smallWindowView.mVideoHeaderView.setTitle(mVideoTitle);
    smallWindowView.mVideoUrl = mVideoUrl;
    smallWindowView.mViewHash = mViewHash;
    TextureView textureView = smallWindowView.createTextureView();
    smallWindowView.mVideoTextureViewContainer.addView(textureView);
    PlayerManager.getInstance().setTextureView(textureView);

    ViewGroup windowContent = (ViewGroup) (Utils.getActivity(getContext())).findViewById(Window.ID_ANDROID_CONTENT);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(mSmallWindowWidth, mSmallWindowHeight);
    lp.gravity = Gravity.RIGHT|Gravity.BOTTOM;
    windowContent.addView(smallWindowView, lp);

    /**
     * 先将小窗口播放视频的View添加到Window后再设置小窗口View的屏幕状态,
     * 否则会导致小窗口触发attach window时又立刻执行了toggleSmallWindow()从而又退出了小窗口播放
     *
     * 下面状态的设置必须在addView之后执行,否则会进入死循环
     */
    smallWindowView.mCurrentScreenState = getCurrentScreenState();
    smallWindowView.mCurrentState = mCurrentState;

    smallWindowView.onPlayStateChanged(mCurrentState);
}
 
private void setupAlignment(RecyclerView recycler) {
    if (!mAlreadyAligned) {
        //setting alignment of header
        ViewGroup.LayoutParams currentParams = getLayoutParams();
        FrameLayout.LayoutParams newHeaderParams;
        int width = ViewGroup.LayoutParams.WRAP_CONTENT;
        int height = ViewGroup.LayoutParams.WRAP_CONTENT;
        int gravity = (mReversed ? Gravity.BOTTOM : Gravity.TOP) | Gravity.CENTER_HORIZONTAL;
        if (currentParams != null) {
            newHeaderParams = new FrameLayout.LayoutParams(getLayoutParams()); //to copy all the margins
            newHeaderParams.width = width;
            newHeaderParams.height = height;
            newHeaderParams.gravity = gravity;
        } else {
            newHeaderParams = new FrameLayout.LayoutParams(width, height, gravity);
        }
        RecyclerViewHeader.this.setLayoutParams(newHeaderParams);

        //setting alignment of recycler
        FrameLayout newRootParent = new FrameLayout(recycler.getContext());
        newRootParent.setLayoutParams(recycler.getLayoutParams());
        ViewParent currentParent = recycler.getParent();
        if (currentParent instanceof ViewGroup) {
            int indexWithinParent = ((ViewGroup) currentParent).indexOfChild(recycler);

            ((ViewGroup) currentParent).removeViewAt(indexWithinParent);
            recycler.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
            newRootParent.addView(recycler);
            newRootParent.addView(RecyclerViewHeader.this);
            ((ViewGroup) currentParent).addView(newRootParent, indexWithinParent);
        }
    }
}
 
源代码13 项目: Mizuu   文件: MizLib.java
/**
 * Add a margin with a height of the ActionBar to the top of a given View contained in a FrameLayout
 * @param c
 * @param v
 */
public static void addActionBarMargin(Context c, View v) {
    int mActionBarHeight = 0;
    TypedValue tv = new TypedValue();
    if (c.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
        mActionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, c.getResources().getDisplayMetrics());
    else
        mActionBarHeight = 0; // No ActionBar style (pre-Honeycomb or ActionBar not in theme)

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    params.setMargins(0, mActionBarHeight, 0, 0);
    v.setLayoutParams(params);
}
 
源代码14 项目: UETool   文件: TransparentActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        finish();
        return;
    }
    Util.setStatusBarColor(getWindow(), Color.TRANSPARENT);
    Util.enableFullscreen(getWindow());
    setContentView(R.layout.uet_activity_transparent);

    vContainer = findViewById(R.id.container);

    final BoardTextView board = new BoardTextView(this);

    type = getIntent().getIntExtra(EXTRA_TYPE, TYPE_UNKNOWN);

    switch (type) {
        case TYPE_EDIT_ATTR:
            EditAttrLayout editAttrLayout = new EditAttrLayout(this);
            editAttrLayout.setOnDragListener(new EditAttrLayout.OnDragListener() {
                @Override
                public void showOffset(String offsetContent) {
                    board.updateInfo(offsetContent);
                }
            });
            vContainer.addView(editAttrLayout);
            break;
        case TYPE_RELATIVE_POSITION:
            vContainer.addView(new RelativePositionLayout(this));
            break;
        case TYPE_SHOW_GRIDDING:
            vContainer.addView(new GriddingLayout(this));
            board.updateInfo("LINE_INTERVAL: " + DimenUtil.px2dip(GriddingLayout.LINE_INTERVAL, true));
            break;
        default:
            Toast.makeText(this, getString(R.string.uet_coming_soon), Toast.LENGTH_SHORT).show();
            finish();
            break;
    }

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    params.gravity = BOTTOM;
    vContainer.addView(board, params);
}
 
源代码15 项目: star-zone-android   文件: DotWidget.java
private void initDotParams(int dotSize) {
    int dotHeightAndWidth = dip2Pixels(dotSize);

    FrameLayout.LayoutParams dotParams = new FrameLayout.LayoutParams(dotHeightAndWidth, dotHeightAndWidth);

    switch (gravity) {
        case GRAVITY_TOP_LEFT:
            dotParams.gravity = Gravity.LEFT | Gravity.TOP;
            break;
        case GRAVITY_TOP_RIGHT:
            dotParams.gravity = Gravity.RIGHT | Gravity.TOP;
            break;
        case GRAVITY_BOTTOM_LEFT:
            dotParams.gravity = Gravity.LEFT | Gravity.BOTTOM;
            break;
        case GRAVITY_BOTTOM_RIGHT:
            dotParams.gravity = Gravity.RIGHT | Gravity.BOTTOM;
            break;
        case GRAVITY_CENTER:
            dotParams.gravity = Gravity.CENTER;
            break;
        case GRAVITY_CENTER_VERTICAL:
            dotParams.gravity = Gravity.CENTER_VERTICAL;
            break;
        case GRAVITY_CENTER_HORIZONTAL:
            dotParams.gravity = Gravity.CENTER_HORIZONTAL;
            break;
        case GRAVITY_LEF_CENTER:
            dotParams.gravity = Gravity.LEFT | Gravity.CENTER_VERTICAL;
            break;
        case GRAVITY_RIGHT_CENTER:
            dotParams.gravity = Gravity.RIGHT | Gravity.CENTER_VERTICAL;
            break;
        default:
            break;
    }

    dotParams.setMargins(marginRect.left, marginRect.top, marginRect.right, marginRect.bottom);

    this.setLayoutParams(dotParams);
}
 
源代码16 项目: paper-launcher   文件: LauncherActivity.java
@Override
public void onPanelSlide(View panel, float slideOffset) {
    mDockViewPagerAdapter.getHomeScreenDockFragment().stopEditAnimation();

    SystemBarUtil.setStatusBarColor(this, (Integer) new ArgbEvaluator().evaluate(slideOffset,
            Color.TRANSPARENT, ContextCompat.getColor(this, R.color.colorStatusBar)));

    if (slideOffset >= 0.6) {
        SystemBarUtil.enableLightStatusBar(this);
    } else {
        SystemBarUtil.clearLightStatusBar(this);
    }

    boolean isShowingHomeScreenDock = mDockViewPager.getCurrentItem() == 0;
    if (isShowingHomeScreenDock) {
        mDockViewPager.scrollTo((int) (mDockViewPager.getWidth() * slideOffset), 0);
    }

    FrameLayout.LayoutParams searchBarCardViewLayoutParams = (FrameLayout.LayoutParams) mSearchBarCardView.getLayoutParams();

    searchBarCardViewLayoutParams.topMargin = (int) (DpPxUtil.dpToPx(this, 32)
            - DpPxUtil.dpToPx(this, 8) * slideOffset);
    searchBarCardViewLayoutParams.leftMargin = (int) (DpPxUtil.dpToPx(this, 8)
            - DpPxUtil.dpToPx(this, 8) * slideOffset);
    searchBarCardViewLayoutParams.rightMargin = (int) (DpPxUtil.dpToPx(this, 8)
            - DpPxUtil.dpToPx(this, 8) * slideOffset);
    searchBarCardViewLayoutParams.height = (int) (DpPxUtil.dpToPx(this, 48)
            + DpPxUtil.dpToPx(this, 8) * slideOffset);

    mSearchBarCardView.setLayoutParams(searchBarCardViewLayoutParams);

    float searchBarCardViewElevation = DpPxUtil.dpToPx(this, 4)
            - DpPxUtil.dpToPx(this, 4) * slideOffset;
    mSearchBarCardView.setCardElevation(searchBarCardViewElevation);

    float searchBarCardViewRadius = DpPxUtil.dpToPx(this, 2)
            - DpPxUtil.dpToPx(this, 2) * slideOffset;
    // CardView bug, if radius equals to 0.xxx, the alpha will be changed
    mSearchBarCardView.setRadius(
            String.valueOf(searchBarCardViewRadius).charAt(0) == '0'
                    ? 0
                    : searchBarCardViewRadius);

    mGoogleArrowImageView.animate()
            .setDuration(0)
            .rotation(-90 * slideOffset)
            .translationX(DpPxUtil.dpToPx(this, 12) * slideOffset)
            .start();

    mGoogleIconImageView.animate()
            .setDuration(0)
            .scaleX(1 - slideOffset)
            .scaleY(1 - slideOffset)
            .start();

    mSearchAppsTextView.animate()
            .setDuration(0)
            .alpha(slideOffset)
            .start();

    mWallpaperOverlay.animate()
            .setDuration(0)
            .alpha(slideOffset)
            .start();

    mSearchAppsWrapperView.animate()
            .setDuration(0)
            .translationX(-DpPxUtil.dpToPx(this, 26) * slideOffset)
            .start();

    mSearchBarPillDividerView.animate()
            .setDuration(0)
            .translationX(-DpPxUtil.dpToPx(this, 16) * slideOffset)
            .start();

    mGoogleMicImageView.setColorFilter((Integer) new ArgbEvaluator().evaluate(slideOffset, Color.TRANSPARENT,
            ContextCompat.getColor(this, R.color.colorMicOnAppDrawer)));
}
 
源代码17 项目: cathode   文件: AppBarScrollParent.java
@Override public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attrs) {
  return new LayoutParams(getContext(), attrs);
}
 
源代码18 项目: Telegram-FOSS   文件: LayoutHelper.java
public static FrameLayout.LayoutParams createFrame(int width, float height, int gravity, float leftMargin, float topMargin, float rightMargin, float bottomMargin) {
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(getSize(width), getSize(height), gravity);
    layoutParams.setMargins(AndroidUtilities.dp(leftMargin), AndroidUtilities.dp(topMargin), AndroidUtilities.dp(rightMargin), AndroidUtilities.dp(bottomMargin));
    return layoutParams;
}
 
@Override
public boolean onTouchEvent(MotionEvent ev) {
    Log.d(TAG, "onTouchEvent --> action = " + (0xFF & ev.getAction()));
    if (isHeaderTop && isEnableZoom) {
        switch (0xFF & ev.getAction()) {
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_OUTSIDE:
                if (!mScalingRunnable.isFinished()) {
                    mScalingRunnable.abortAnimation();
                }
                mLastMotionY = ev.getY();
                mActivePointerId = ev.getPointerId(0);
                mMaxScale = (mScreenHeight / mZoomHeight);
                mLastScale = (mZoomContainer.getBottom() / mZoomHeight);
                if (onScrollViewZoomListener != null) {
                    onScrollViewZoomListener.onStart();
                }
                break;
            case MotionEvent.ACTION_MOVE:
                Log.d(TAG, "mActivePointerId = " + mActivePointerId);
                int j = ev.findPointerIndex(this.mActivePointerId);
                if (j == -1) {
                    Log.e(TAG, "Invalid pointerId = " + mActivePointerId + " in onTouchEvent");
                } else {
                    if (mLastMotionY == -1.0F) {
                        mLastMotionY = ev.getY(j);
                    }
                    if (mZoomContainer.getBottom() >= mZoomHeight) {
                        FrameLayout.LayoutParams localLayoutParams = (FrameLayout.LayoutParams) mZoomContainer.getLayoutParams();
                        ViewGroup.LayoutParams headLayoutParams = mHeaderContainer.getLayoutParams();
                        float f = ((ev.getY(j) - mLastMotionY + mZoomContainer.getBottom()) / mZoomHeight - mLastScale) / 2.0F + mLastScale;
                        if ((mLastScale <= 1.0D) && (f < mLastScale)) {
                            localLayoutParams.height = mZoomHeight;
                            localLayoutParams.width = mZoomWidth;
                            localLayoutParams.gravity = Gravity.CENTER;
                            headLayoutParams.height = mZoomHeight;
                            mZoomContainer.setLayoutParams(localLayoutParams);
                            mHeaderContainer.setLayoutParams(headLayoutParams);
                            return super.onTouchEvent(ev);
                        }
                        mLastScale = Math.min(Math.max(f, 1.0F), mMaxScale);
                        localLayoutParams.height = ((int) (mZoomHeight * mLastScale));
                        localLayoutParams.width = ((int) (mZoomWidth * mLastScale));
                        localLayoutParams.gravity = Gravity.CENTER;
                        headLayoutParams.height = ((int) (mZoomHeight * mLastScale));
                        if (localLayoutParams.height < mScreenHeight) {
                            mZoomContainer.setLayoutParams(localLayoutParams);
                            mHeaderContainer.setLayoutParams(headLayoutParams);
                        }
                        mLastMotionY = ev.getY(j);
                        return true;
                    }
                    this.mLastMotionY = ev.getY(j);
                }
                break;
            case MotionEvent.ACTION_UP:
                reset();
                endScaling();
                if (onScrollViewZoomListener != null) {
                    onScrollViewZoomListener.onFinish();
                }
                break;
            case MotionEvent.ACTION_CANCEL:
                int i = ev.getActionIndex();
                mLastMotionY = ev.getY(i);
                mActivePointerId = ev.getPointerId(i);
                break;
            case MotionEvent.ACTION_POINTER_DOWN:
                onSecondaryPointerUp(ev);
                mLastMotionY = ev.getY(ev.findPointerIndex(mActivePointerId));
                break;
        }
    }
    return super.onTouchEvent(ev);
}
 
源代码20 项目: fanfouapp-opensource   文件: AppMsg.java
/**
 * Constructs and sets the layout parameters to have some gravity.
 * 
 * @param gravity
 *            the gravity of the Crouton
 * @return <code>this</code>, for chaining.
 * @see android.view.Gravity
 */
public AppMsg setLayoutGravity(final int gravity) {
    this.mLayoutParams = new FrameLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, gravity);
    return this;
}