Android HorizontalScrollView - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android HorizontalScrollView class.

This code example shows how to use the following methods:scrollBy
            // For some reason we need to post this action, rather than call immediately. 
            // If we try immediately, it will not scroll. 
            new Handler().post(new Runnable() {
                @Override 
                public void run() { 
                    me.scrollBy(scrollToViewPos, 0);
                } 
            }); 
        } 
    } 
 
    /** 
     * Callback interface to interact with the HSV. 
     */ 
    public interface SizeCallback { 
        /** 
         * Used to allow clients to measure Views before re-adding them. 
         */ 
        public void onGlobalLayout(); 
 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setLayoutParams, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		views = new ArrayList<View>();
		 
		if(isVertical){
			scroll = new ScrollView(this.getContext());
		} else { 
			scroll = new HorizontalScrollView(this.getContext());
		} 
		quilt = new QuiltViewBase(getContext(), isVertical);
		scroll.addView(quilt);
		this.addView(scroll);
		 
	} 
	 
	public void addPatchImages(ArrayList<ImageView> images){
		 
		for(ImageView image: images){
			FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
			image.setLayoutParams(params);
			 
			LinearLayout wrapper = new LinearLayout(this.getContext());
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		HorizontalScrollView scrollView;
 
		if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
			scrollView = new InternalHorizontalScrollViewSDK9(context, attrs);
		} else { 
			scrollView = new HorizontalScrollView(context, attrs);
		} 
 
		scrollView.setId(R.id.scrollview);
		return scrollView;
	} 
 
	@Override 
	protected boolean isReadyForPullStart() { 
		return mRefreshableView.getScrollX() == 0; 
	} 
 
	@Override 
	protected boolean isReadyForPullEnd() { 
		View scrollViewChild = mRefreshableView.getChildAt(0);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getWidth, postDelayed, setFillViewport, smoothScrollTo
            public void run() { 
                View tabView = widget.getChildAt(position);
                if (tabView != null) {
                    HorizontalScrollView scrollView = (HorizontalScrollView) widget.getParent();
                    assert scrollView != null;
                    scrollView.setFillViewport(true);
 
                    final int scrollPos = tabView.getLeft() - (scrollView.getWidth() - tabView.getWidth()) / 2;
                    scrollView.smoothScrollTo(scrollPos, 0);
                    scrollView.postDelayed(new Runnable() {
                        @Override 
                        public void run() { 
                            onTabPageSelected(position);
                        } 
                    }, 250); 
                } 
            } 
        }, 250); 
    } 
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getScrollX, getWidth, smoothScrollBy
This code example shows how to use the following methods:setLayoutParams, addView
        /** 
         * rant: the idea that Android can't handle vertical AND horizontal scrolling at once is 
         * ridiculous.  I can't believe this ugly hack, this class, is required to create the illusion 
         * of scrolling on both axes. 
         */ 
        horizontalScrollView = new HorizontalScrollView(context);
        setLayoutParams(params);
        horizontalScrollView.setLayoutParams(params);
        super.addView(horizontalScrollView);
        horizontalScrollView.addView(container);
    } 
 
    public void addView(View view) {
        container.addView(view);
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getScrollX, getScrollY, getWidth
		 
 
		float x = event.getX();
		float y = event.getY();
		 
		int scrollerX = scrollView.getScrollX();
		int scrollerY = scrollView.getScrollY();
		 
		int scrollViewWidth = scrollView.getWidth();
		int page = scrollerX / scrollViewWidth;
		 
		switch (event.getAction()) {
		 
			case MotionEvent.ACTION_DOWN:
			 
				 
				break; 
 
			case MotionEvent.ACTION_UP:
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMeasuredWidth, smoothScrollTo
                        return true; 
                    } 
                    //left to right 
                    else if (velocityX > 0 && Math.abs(velocityX) > 300) {
                    	Log.i(TAG, "MyGestureDetector - Processing onFling LtoR");
                        int featureWidth = mHorizontalScrollView.getMeasuredWidth();
                        mActiveFeature = (mActiveFeature > 0)? mActiveFeature - 1:0;
                        mHorizontalScrollView.smoothScrollTo(mActiveFeature*featureWidth, 0);
                        return true; 
                    } 
                } catch (Exception e) {
                        Log.e("Fling", "There was an error processing the Fling event:" + e.getMessage());
                } 
                return false; 
            } 
        } 
 
        public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, String tabName) {
            tabSpec.setContent(new DummyTabFactory(mContext));
            String tag = tabSpec.getTag();
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getViewTreeObserver, getChildAt
        mScrollView = (HorizontalScrollView)findViewById(R.id.tabscroll);
        ViewTreeObserver vto = mScrollView.getViewTreeObserver();
        vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
            @Override 
            public void onGlobalLayout() { 
                mScrollView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                mScrollWidth = mScrollView.getChildAt(0).getMeasuredWidth() 
                        - getWindowManager().getDefaultDisplay().getWidth();
 
            } 
        });         
         
        /* 
         * Start service now, bind later. This will be no-op if service is already running 
         */ 
        Intent intent = new Intent(this, StorageService.class);
        startService(intent);
 
        /* 
         * Make a tab host 
5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android HorizontalScrollView Questions & Answers:

See Code Examples for Android HorizontalScrollView Methods: