當前位置: 首頁>>代碼示例>>Java>>正文


Java OnLayoutChangeListener類代碼示例

本文整理匯總了Java中android.view.View.OnLayoutChangeListener的典型用法代碼示例。如果您正苦於以下問題:Java OnLayoutChangeListener類的具體用法?Java OnLayoutChangeListener怎麽用?Java OnLayoutChangeListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OnLayoutChangeListener類屬於android.view.View包,在下文中一共展示了OnLayoutChangeListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: _setPriceAxisOnLayoutChangeListener

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
private void 
_setPriceAxisOnLayoutChangeListener(){            
    _pAxisLayoutChngLstnr = new OnLayoutChangeListener(){        
                                @Override
                                public void 
                                onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, 
                                        int oldTop, int oldRight, int oldBottom){     
                                    for( BaseChartFragmentA tmp = getTopOfStack(); 
                                         tmp != getBaseOfStack();     
                                         tmp = tmp.getLastLinkOfStack())
                                         {                    
                                             tmp.getView()
                                                .findViewById(R.id.chart_right_panel_spacer)
                                                .setLayoutParams( new LinearLayout.LayoutParams(right-left, 
                                                    LinearLayout.LayoutParams.MATCH_PARENT) );
                                         }                
                                }    
                            };
                            
    ((LinearLayout)(_myViewGroup.findViewById(R.id.chart_right_panel_holder)))
        .addOnLayoutChangeListener(_pAxisLayoutChngLstnr);
}
 
開發者ID:jeog,項目名稱:SpunkyCharts,代碼行數:23,代碼來源:TraditionalChartFragment.java

示例2: hideBottomBar

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
private void hideBottomBar() {
    if (mBottomBarView == null) return;
    ((ViewGroup) mBottomBarView.getParent()).removeView(mBottomBarView);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.BOTTOM;
    final ViewGroup compositorView = mActivity.getCompositorViewHolder();
    compositorView.addView(mBottomBarView, lp);
    compositorView.addOnLayoutChangeListener(new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom,
                int oldLeft, int oldTop, int oldRight, int oldBottom) {
            compositorView.removeOnLayoutChangeListener(this);
            mBottomBarView.animate().alpha(0f).translationY(mBottomBarView.getHeight())
                    .setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE)
                    .setDuration(SLIDE_ANIMATION_DURATION_MS)
                    .withEndAction(new Runnable() {
                        @Override
                        public void run() {
                            ((ViewGroup) mBottomBarView.getParent()).removeView(mBottomBarView);
                            mBottomBarView = null;
                        }
                    }).start();
        }
    });
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:27,代碼來源:CustomTabBottomBarDelegate.java

示例3: FocusAnimator

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
/**
 * Constructs the {@link FocusAnimator}.
 *
 * To get the correct values to animate between, this should be called immediately before the
 * children of the layout are remeasured.
 *
 * @param layout       Layout being animated.
 * @param focusedChild Child being focused, or null if none is being focused.
 * @param callback     Callback to run when children are in the correct places.
 */
public FocusAnimator(
        LinearLayout layout, @Nullable View focusedChild, final Runnable callback) {
    mLayout = layout;
    mFocusedChild = focusedChild;
    mInitialNumberOfChildren = mLayout.getChildCount();
    mInitialTops = calculateChildTops();

    // Add a listener to know when Android has done another measurement pass.  The listener
    // automatically removes itself to prevent triggering the animation multiple times.
    mLayout.addOnLayoutChangeListener(new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom,
                int oldLeft, int oldTop, int oldRight, int oldBottom) {
            mLayout.removeOnLayoutChangeListener(this);
            startAnimator(callback);
        }
    });
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:29,代碼來源:FocusAnimator.java

示例4: showRemoteViews

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
private void showRemoteViews(RemoteViews remoteViews) {
    final View inflatedView = remoteViews.apply(mActivity, getBottomBarView());
    if (mClickableIDs != null && mClickPendingIntent != null) {
        for (int id: mClickableIDs) {
            if (id < 0) return;
            View view = inflatedView.findViewById(id);
            if (view != null) view.setOnClickListener(mBottomBarClickListener);
        }
    }
    getBottomBarView().addView(inflatedView, 1);
    inflatedView.addOnLayoutChangeListener(new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom,
                int oldLeft, int oldTop, int oldRight, int oldBottom) {
            inflatedView.removeOnLayoutChangeListener(this);
            mFullscreenManager.setBottomControlsHeight(v.getHeight());
        }
    });
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:20,代碼來源:CustomTabBottomBarDelegate.java

示例5: initChart

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
/**
 * Initialises the chart and sets the correct radio button.  This is 
 * called from onCreate() as well as from onRadioButtonClicked().
 *
 */
private void initChart()
{
    final ChartSurfaceView csv
            = (ChartSurfaceView) findViewById(R.id.chartView);
    Chart3D chart = null;
    chart = Charts.createDemoScatterChart(-1.0, -1.0, -1.0);
    csv.setChart(chart);

    // here we add a listener that will zoom-to-fit the new chart when
    // the layout changes...
    csv.addOnLayoutChangeListener(new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right,
                                   int bottom, int oldLeft, int oldTop, int oldRight,
                                   int oldBottom) {
            csv.zoomToFit(right - left, bottom - top);
        }
    });

}
 
開發者ID:droiddeveloper1,項目名稱:android-wear-gestures-recognition,代碼行數:26,代碼來源:testActivity.java

示例6: _syncPanels

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
private void 
_syncPanels(){
    final TextView tv = (TextView)_rightPanel.findViewById(R.id.xAxis_mirror);        
    final int innerHeight = getResources().getDimensionPixelSize(R.dimen.chart_frag_trad_inner_axis_height);
            
    _xAxis.addOnLayoutChangeListener( new OnLayoutChangeListener(){ 
                                          /* synch X-Axis heights */
                                          @Override
                                          public void 
                                          onLayoutChange(View v, int left, int top, int right, int bottom, 
                                                  int oldLeft, int oldTop, int oldRight, int oldBottom){
                                              tv.setLayoutParams( new LinearLayout.LayoutParams(
                                                  LinearLayout.LayoutParams.WRAP_CONTENT, 
                                                  (int)((bottom-top)+ innerHeight) ) );
                                              _rightPanel.invalidate();                    
                                          }                
                                      } );     
}
 
開發者ID:jeog,項目名稱:SpunkyCharts,代碼行數:19,代碼來源:TraditionalChartFragment.java

示例7: _syncPanels

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
private void 
_syncPanels(){
    final TextView tv = (TextView)_rightPanel.findViewById(R.id.xAxis_mirror);
    
    _xAxis.addOnLayoutChangeListener(
        new OnLayoutChangeListener(){ /* synch X-Axis heights */
            @Override
            public void 
            onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, 
                int oldRight, int oldBottom){
                    tv.setLayoutParams( new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, 
                        (int)(bottom-top)) );                    
                    _rightPanel.invalidate();                    
            }                
        } 
    );     
}
 
開發者ID:jeog,項目名稱:SpunkyCharts,代碼行數:18,代碼來源:PriceByVolumeChartFragment.java

示例8: PanZoomCalculator

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
PanZoomCalculator(View container, View child, int anchor) {
	// Initialize class fields
	currentPan = new PointF(0, 0);
	currentZoom = 1f;
	;
	this.window = container;
	this.child = child;
	matrix = new Matrix();
	this.anchor = anchor;
	onPanZoomChanged();
	this.child.addOnLayoutChangeListener(new OnLayoutChangeListener() {
		// This catches when the image bitmap changes, for some reason
		// it doesn't recurse

		public void onLayoutChange(View v, int left, int top,
				int right, int bottom, int oldLeft, int oldTop,
				int oldRight, int oldBottom) {
			onPanZoomChanged();
		}
	});
}
 
開發者ID:jeremyfr,項目名稱:co_nomad,代碼行數:22,代碼來源:PanAndZoomListener.java

示例9: prepareIconAnimation

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
private void prepareIconAnimation() {
    authenticationText.setAlpha(0.0f);
    trustText.setAlpha(0.0f);

    dialogView.addOnLayoutChangeListener(new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View view, int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7) {
            float halfVerticalPixelDifference = (trustIconFrame.getY() - authenticationIconFrame.getY()) / 2.0f;
            authenticationIconFrame.setTranslationY(halfVerticalPixelDifference);
            trustIconFrame.setTranslationY(-halfVerticalPixelDifference);

            authenticationIconFrame.animate().translationY(0)
                    .setStartDelay(ICON_ANIM_DELAY)
                    .setDuration(ICON_ANIM_DURATION)
                    .setInterpolator(new AccelerateDecelerateInterpolator())
                    .start();
            trustIconFrame.animate().translationY(0)
                    .setStartDelay(ICON_ANIM_DELAY)
                    .setDuration(ICON_ANIM_DURATION)
                    .setInterpolator(new AccelerateDecelerateInterpolator())
                    .start();
            authenticationText.animate().alpha(1.0f).setStartDelay(ICON_ANIM_DELAY + ICON_ANIM_DURATION).start();
            trustText.animate().alpha(1.0f).setStartDelay(ICON_ANIM_DELAY + ICON_ANIM_DURATION).start();

            view.removeOnLayoutChangeListener(this);
        }
    });
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:29,代碼來源:SecurityInfoDialog.java

示例10: show

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
void show() {
    addToParent();
    mView.addOnLayoutChangeListener(new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom,
                int oldLeft, int oldTop, int oldRight, int oldBottom) {
            mView.removeOnLayoutChangeListener(this);
            mView.setTranslationY(mView.getHeight() + getLayoutParams().bottomMargin);
            Animator animator = ObjectAnimator.ofFloat(mView, View.TRANSLATION_Y, 0);
            animator.setInterpolator(new DecelerateInterpolator());
            animator.setDuration(mAnimationDuration);
            startAnimatorOnSurfaceView(animator);
        }
    });
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:16,代碼來源:SnackbarView.java

示例11: addOnLayoutChangeListenerToDropDownAnchorSDK11

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
@TargetApi(11)
private void addOnLayoutChangeListenerToDropDownAnchorSDK11() {
    this.mDropDownAnchor.addOnLayoutChangeListener(new OnLayoutChangeListener() {
        public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
            SearchView.this.adjustDropDownSizeAndPosition();
        }
    });
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:9,代碼來源:SearchView.java

示例12: prepareIconAnimation

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
private void prepareIconAnimation() {
    topText.setAlpha(0.0f);
    bottomText.setAlpha(0.0f);

    dialogView.addOnLayoutChangeListener(new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View view, int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7) {
            float halfVerticalPixelDifference = (bottomIconFrame.getY() - topIconFrame.getY()) / 2.0f;
            topIconFrame.setTranslationY(halfVerticalPixelDifference);
            bottomIconFrame.setTranslationY(-halfVerticalPixelDifference);

            topIconFrame.animate().translationY(0)
                    .setStartDelay(ICON_ANIM_DELAY)
                    .setDuration(ICON_ANIM_DURATION)
                    .setInterpolator(new AccelerateDecelerateInterpolator())
                    .start();
            bottomIconFrame.animate().translationY(0)
                    .setStartDelay(ICON_ANIM_DELAY)
                    .setDuration(ICON_ANIM_DURATION)
                    .setInterpolator(new AccelerateDecelerateInterpolator())
                    .start();
            topText.animate().alpha(1.0f).setStartDelay(ICON_ANIM_DELAY + ICON_ANIM_DURATION).start();
            bottomText.animate().alpha(1.0f).setStartDelay(ICON_ANIM_DELAY + ICON_ANIM_DURATION).start();

            view.removeOnLayoutChangeListener(this);
        }
    });
}
 
開發者ID:scoute-dich,項目名稱:K9-MailClient,代碼行數:29,代碼來源:CryptoInfoDialog.java

示例13: initPreviewScroller

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
private void initPreviewScroller() {

        MaxHeightScrollView preview = (MaxHeightScrollView) findViewById(R.id.preview_scroller);
        if (preview == null)
            return;
        final int margin = ((ViewGroup.MarginLayoutParams) preview.getLayoutParams()).bottomMargin;
        preview.addOnLayoutChangeListener(new OnLayoutChangeListener(){
            public void onLayoutChange(View v, int left, int top, int right, int bottom,
                    int oldLeft, int oldTop, int oldRight, int oldBottom) {
                // animate preview height changes
                if (oldBottom != bottom) {
                    final View e = findViewById(R.id.editors);
                    final int y = bottom + margin;
                    e.animate()
                        .translationY(y - oldBottom)
                        .setListener(new AnimatorListenerAdapter() {
                            public void onAnimationEnd(Animator animation) {
                                FrameLayout.LayoutParams lp = (LayoutParams) e.getLayoutParams();
                                lp.topMargin = y;
                                e.setTranslationY(0);
                                e.setLayoutParams(lp);
                            }
                        });
                }
            }});

        // limit the max height for preview, leave room for editors + soft keyboard
        DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);
        float actualHeight = dm.heightPixels / dm.ydpi;
        float pct = actualHeight < 3.5 ? .32f :
                    actualHeight < 4 ? .35f :
                    .38f;
        preview.setMaxHeight((int)(dm.heightPixels * pct));
    }
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:36,代碼來源:NotificationStudioActivity.java

示例14: addOnLayoutChangeListenerToDropDownAnchorSDK11

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
@TargetApi(11)
private void addOnLayoutChangeListenerToDropDownAnchorSDK11()
{
  this.mDropDownAnchor.addOnLayoutChangeListener(new View.OnLayoutChangeListener()
  {
    public final void onLayoutChange(View paramAnonymousView, int paramAnonymousInt1, int paramAnonymousInt2, int paramAnonymousInt3, int paramAnonymousInt4, int paramAnonymousInt5, int paramAnonymousInt6, int paramAnonymousInt7, int paramAnonymousInt8)
    {
      SearchView.this.adjustDropDownSizeAndPosition();
    }
  });
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:12,代碼來源:SearchView.java

示例15: DropdownPopupWindow

import android.view.View.OnLayoutChangeListener; //導入依賴的package包/類
/**
 * Creates an DropdownPopupWindow with specified parameters.
 * @param context Application context.
 * @param anchorView Popup view to be anchored.
 */
public DropdownPopupWindow(Context context, View anchorView) {
    super(context, null, 0, R.style.DropdownPopupWindow);
    mContext = context;
    mAnchorView = anchorView;

    mAnchorView.setId(R.id.dropdown_popup_window);
    mAnchorView.setTag(this);

    mLayoutChangeListener = new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom,
                int oldLeft, int oldTop, int oldRight, int oldBottom) {
            if (v == mAnchorView) DropdownPopupWindow.this.show();
        }
    };
    mAnchorView.addOnLayoutChangeListener(mLayoutChangeListener);

    super.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            if (mOnDismissListener != null) {
                mOnDismissListener.onDismiss();
            }
            mAnchorView.removeOnLayoutChangeListener(mLayoutChangeListener);
            mAnchorView.setTag(null);
        }
    });

    setAnchorView(mAnchorView);
    Rect originalPadding = new Rect();
    getBackground().getPadding(originalPadding);
    setVerticalOffset(-originalPadding.top);
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:39,代碼來源:DropdownPopupWindow.java


注:本文中的android.view.View.OnLayoutChangeListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。