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


Java OnScrollChangedListener類代碼示例

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


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

示例1: initView

import android.view.ViewTreeObserver.OnScrollChangedListener; //導入依賴的package包/類
private void initView() {
    this.scrollView.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {
        int HEIGHT = RadarActivity.this.getResources().getDisplayMetrics().heightPixels;
        int[] area = new int[2];

        public void onScrollChanged() {
            RadarActivity.this.nutritionLayout.getLocationOnScreen(this.area);
            if (this.area[1] + RadarActivity.this.nutritionLayout.getHeight() < this.HEIGHT) {
                RadarActivity.this.nutritionLayout.startAnim();
            }
            RadarActivity.this.sportLayout.getLocationOnScreen(this.area);
            if (this.area[1] + RadarActivity.this.sportLayout.getHeight() < this.HEIGHT) {
                RadarActivity.this.sportLayout.startAnim();
            }
            RadarActivity.this.ringNutrition.getLocationOnScreen(this.area);
            if (this.area[1] + RadarActivity.this.ringNutrition.getHeight() < this.HEIGHT) {
                RadarActivity.this.ringNutrition.startAnim();
            }
            RadarActivity.this.ringHeat.getLocationInWindow(this.area);
            if (this.area[1] + RadarActivity.this.ringHeat.getHeight() < this.HEIGHT) {
                RadarActivity.this.ringHeat.startAnim();
            }
        }
    });
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:26,代碼來源:RadarActivity.java

示例2: setScrollView

import android.view.ViewTreeObserver.OnScrollChangedListener; //導入依賴的package包/類
private void setScrollView(){
	sv.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {

			@Override
			public void onScrollChanged() {
				int scrollY = sv.getScrollY(); //for verticalScrollView
				mHeader.setTranslationY(Math.max(-scrollY, mMinHeaderTranslation));
				//header_logo --> actionbar icon
				float ratio = clamp(mHeader.getTranslationY() / mMinHeaderTranslation, 0.0f, 1.0f);
				interpolate(mHeaderLogo, getActionBarIconView(), mSmoothInterpolator.getInterpolation(ratio));
				interpolate2(sp, getActionBarIconView(), mSmoothInterpolator.getInterpolation(ratio));
				//actionbar title alpha
				//getActionBarTitleView().setAlpha(clamp(5.0F * ratio - 4.0F, 0.0F, 1.0F));
				//---------------------------------
				//better way thanks to @cyrilmottier
				setTitleAlpha(clamp(5.0F * ratio - 4.0F, 0.0F, 1.0F));

			}
		});
}
 
開發者ID:DhianRusdhiana,項目名稱:KTA-Editor,代碼行數:21,代碼來源:KTAEditor.java

示例3: init

import android.view.ViewTreeObserver.OnScrollChangedListener; //導入依賴的package包/類
private void init() {
    if (superListenerField != null) {
        try {
            mSuperScrollListener = (OnScrollChangedListener) superListenerField.get(this);
            superListenerField.set(this, NOP);
        } catch (Exception e) {
            mSuperScrollListener = null;
        }
    }
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:11,代碼來源:PopupWindowCompat.java

示例4: m2531a

import android.view.ViewTreeObserver.OnScrollChangedListener; //導入依賴的package包/類
private static void m2531a(PopupWindow popupWindow) {
    try {
        Field declaredField = PopupWindow.class.getDeclaredField("mAnchor");
        declaredField.setAccessible(true);
        Field declaredField2 = PopupWindow.class.getDeclaredField("mOnScrollChangedListener");
        declaredField2.setAccessible(true);
        declaredField2.set(popupWindow, new ba(declaredField, popupWindow, (OnScrollChangedListener) declaredField2.get(popupWindow)));
    } catch (Throwable e) {
        Log.d("AppCompatPopupWindow", "Exception while installing workaround OnScrollChangedListener", e);
    }
}
 
開發者ID:Qwaz,項目名稱:solved-hacking-problem,代碼行數:12,代碼來源:az.java

示例5: call

import android.view.ViewTreeObserver.OnScrollChangedListener; //導入依賴的package包/類
@Override
public void call(final Subscriber<? super ViewScrollChangeEvent> subscriber) {
    final ViewTreeObserver viewTreeObserver = view.getViewTreeObserver();

    final OnScrollChangedListener listener = new OnScrollChangedListener() {
        int oldX, oldY;

        @Override
        public void onScrollChanged() {
            if (!subscriber.isUnsubscribed()) {
                int scrollX = view.getScrollX();
                int scrollY = view.getScrollY();
                subscriber.onNext(ViewScrollChangeEvent.create(view, scrollX, scrollY, oldX, oldY));
                oldX = scrollX;
                oldY = scrollY;
            }
        }
    };
    viewTreeObserver.addOnScrollChangedListener(listener);

    subscriber.add(new MainThreadSubscription() {
        @Override
        protected void onUnsubscribe() {
            viewTreeObserver.removeOnScrollChangedListener(listener);
        }
    });
}
 
開發者ID:st1hy,項目名稱:Red-Calorie,代碼行數:28,代碼來源:ViewTreeScrollChangedListener.java

示例6: zza

import android.view.ViewTreeObserver.OnScrollChangedListener; //導入依賴的package包/類
public static void zza(Activity paramActivity, ViewTreeObserver.OnScrollChangedListener paramOnScrollChangedListener)
{
  Window localWindow = paramActivity.getWindow();
  if ((localWindow != null) && (localWindow.getDecorView() != null) && (localWindow.getDecorView().getViewTreeObserver() != null)) {
    localWindow.getDecorView().getViewTreeObserver().addOnScrollChangedListener(paramOnScrollChangedListener);
  }
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:8,代碼來源:zziq.java

示例7: zzb

import android.view.ViewTreeObserver.OnScrollChangedListener; //導入依賴的package包/類
public static void zzb(Activity paramActivity, ViewTreeObserver.OnScrollChangedListener paramOnScrollChangedListener)
{
  Window localWindow = paramActivity.getWindow();
  if ((localWindow != null) && (localWindow.getDecorView() != null) && (localWindow.getDecorView().getViewTreeObserver() != null)) {
    localWindow.getDecorView().getViewTreeObserver().removeOnScrollChangedListener(paramOnScrollChangedListener);
  }
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:8,代碼來源:zziq.java

示例8: IncognitoBottomSheetContent

import android.view.ViewTreeObserver.OnScrollChangedListener; //導入依賴的package包/類
/**
 * Constructs a new IncognitoBottomSheetContent.
 * @param activity The {@link Activity} displaying this bottom sheet content.
 */
public IncognitoBottomSheetContent(final Activity activity) {
    LayoutInflater inflater = LayoutInflater.from(activity);
    mView = inflater.inflate(R.layout.incognito_bottom_sheet_content, null);

    View learnMore = mView.findViewById(R.id.learn_more);
    learnMore.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            HelpAndFeedback.getInstance(activity).show(activity,
                    activity.getString(R.string.help_context_incognito_learn_more),
                    Profile.getLastUsedProfile(), null);
        }
    });

    final FadingShadowView shadow = (FadingShadowView) mView.findViewById(R.id.shadow);
    shadow.init(
            ApiCompatibilityUtils.getColor(mView.getResources(), R.color.toolbar_shadow_color),
            FadingShadow.POSITION_TOP);

    mScrollView = (ScrollView) mView.findViewById(R.id.scroll_view);
    mScrollView.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {
        @Override
        public void onScrollChanged() {
            boolean shadowVisible = mScrollView.canScrollVertically(-1);
            shadow.setVisibility(shadowVisible ? View.VISIBLE : View.GONE);
        }
    });
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:33,代碼來源:IncognitoBottomSheetContent.java


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