本文整理汇总了Java中com.google.samples.apps.iosched.ui.widget.ObservableScrollView类的典型用法代码示例。如果您正苦于以下问题:Java ObservableScrollView类的具体用法?Java ObservableScrollView怎么用?Java ObservableScrollView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObservableScrollView类属于com.google.samples.apps.iosched.ui.widget包,在下文中一共展示了ObservableScrollView类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.google.samples.apps.iosched.ui.widget.ObservableScrollView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_detail);
mSelectedVideo = getIntent().getExtras().getParcelable(KEY_BUNDLE_VIDEO);
mObservableScrollView = (ObservableScrollView) findViewById(R.id.activity_detail_scroller);
loadImage();
initToolbar();
initContent(savedInstanceState);
initContentHeader();
initFAB();
initParallaxEffect();
}
开发者ID:GDG-Korea,项目名称:holo_to_material,代码行数:17,代码来源:VideoDetailActivity.java
示例2: initViews
import com.google.samples.apps.iosched.ui.widget.ObservableScrollView; //导入依赖的package包/类
private void initViews() {
mFABElevation = getResources().getDimensionPixelSize(R.dimen.fab_elevation);
mMaxHeaderElevation = getResources().getDimensionPixelSize(
R.dimen.session_detail_max_header_elevation);
mScrollView = (ObservableScrollView) getActivity().findViewById(R.id.scroll_view);
mScrollView.addCallbacks(this);
ViewTreeObserver vto = mScrollView.getViewTreeObserver();
if (vto.isAlive()) {
vto.addOnGlobalLayoutListener(mGlobalLayoutListener);
}
mScrollViewChild = getActivity().findViewById(R.id.scroll_view_child);
mScrollViewChild.setVisibility(View.INVISIBLE);
mDetailsContainer = getActivity().findViewById(R.id.details_container);
mHeaderBox = getActivity().findViewById(R.id.header_session);
mTitle = (TextView) getActivity().findViewById(R.id.session_title);
mSubtitle = (TextView) getActivity().findViewById(R.id.session_subtitle);
mPhotoViewContainer = getActivity().findViewById(R.id.session_photo_container);
mPhotoView = (ImageView) getActivity().findViewById(R.id.session_photo);
mAbstract = (TextView) getActivity().findViewById(R.id.session_abstract);
mPlusOneIcon = (ImageView) getActivity().findViewById(R.id.gplus_icon_box);
mTwitterIcon = (ImageView) getActivity().findViewById(R.id.twitter_icon_box);
//Find view that shows a Videocam icon if the session is being live streamed.
mLiveStreamVideocamIconAndText = (TextView) getActivity().findViewById(
R.id.live_stream_videocam_icon_and_text);
// Find view that shows a play button and some text for the user to watch the session live stream.
mLiveStreamPlayIconAndText = (TextView) getActivity().findViewById(
R.id.live_stream_play_icon_and_text);
mRequirements = (TextView) getActivity().findViewById(R.id.session_requirements);
mTags = (LinearLayout) getActivity().findViewById(R.id.session_tags);
mTagsContainer = (ViewGroup) getActivity().findViewById(R.id.session_tags_container);
ViewCompat.setTransitionName(mPhotoView, SessionDetailConstants.TRANSITION_NAME_PHOTO);
mAddScheduleButtonContainer = getActivity()
.findViewById(R.id.add_schedule_button_container);
mAddScheduleButton = (CheckableFloatingActionButton) getActivity()
.findViewById(R.id.add_schedule_button);
mNoPlaceholderImageLoader = new ImageLoader(getContext());
mSpeakersImageLoader = new ImageLoader(getContext(), R.drawable.person_image_empty);
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:50,代码来源:SessionDetailFragment.java
示例3: initParallaxEffect
import com.google.samples.apps.iosched.ui.widget.ObservableScrollView; //导入依赖的package包/类
private void initParallaxEffect() {
final View contentImage = mObservableScrollView.findViewById(R.id.content_image);
final View contentHeader = mObservableScrollView.findViewById(R.id.content_header);
final View contentHeaderShadow
= mObservableScrollView.findViewById(R.id.content_header_shadow);
final View fabPlayButton = mObservableScrollView.findViewById(R.id.content_play);
mObservableScrollView.addCallbacks(new ObservableScrollView.Callbacks() {
public static final String TAG = "ObservableScrollView";
@Override
public void onScrollChanged(int deltaX, int deltaY) {
final int scrollY = mObservableScrollView.getScrollY();
// relocate the position of contentHeader
if (contentHeader.getY() < scrollY) {
mIsHeaderSticky = true;
} else if (scrollY <= mInitialContentHeaderPos) {
mIsHeaderSticky = false;
contentHeader.setY(mInitialContentHeaderPos);
contentHeaderShadow.setY(mInitialContentHeaderPos
+ contentHeader.getHeight());
fabPlayButton.setY(mInitialContentHeaderPos
+ contentHeader.getHeight() - fabPlayButton.getHeight() / 2);
}
if (mIsHeaderSticky) {
contentHeader.setY(scrollY);
contentHeaderShadow.setY(scrollY + contentHeader.getHeight());
fabPlayButton.setY(scrollY + contentHeader.getHeight()
- fabPlayButton.getHeight() / 2);
}
// relocate the position of contentImage
final float currPosY = contentImage.getY();
final float futurePosY = currPosY + (deltaY / 2.f);
if (futurePosY >= mMaxContentImagePos) {
contentImage.setY(mMaxContentImagePos);
} else if (futurePosY <= 0) {
contentImage.setY(0.f);
} else {
contentImage.setY(futurePosY);
}
}
});
}
开发者ID:GDG-Korea,项目名称:holo_to_material,代码行数:49,代码来源:VideoDetailActivity.java
注:本文中的com.google.samples.apps.iosched.ui.widget.ObservableScrollView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论