• Stars
    star
    535
  • Rank 82,940 (Top 2 %)
  • Language
    Java
  • Created almost 12 years ago
  • Updated almost 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Parallax ScrollView which takes a background and foreground views - DEPRECATED

ParallaxScrollView - DEPRECATED

DEPRECATED - Use the project for more of guide and ideas how to apply parallax techniques. Parralloid has more abstract implimentations.

A Parallax ScrollView which takes a background and foreground view, in the ParallexScrollView.

Demo

Please download the demo. Bakground image thanks to shoptalklondon.

Usage

Look at the demo layout for implimentation.

The basics are, that you need two views added to the ParallaxScrollView and it will do the rest.

  • The first View added is the Background
  • The second View added is the Foreground.

Layout and measuring is based roughly around a FrameLayout.

The foreground view gets wrapped with a ObservableScrollView regardless with what you put in there, so if you want full control of layout impliment like below.

Attributes

  • app:parallexOffset="0.3" - this number needs to be between 0.1 and 1.0. otherwise it defaults to 0.3.
  • ParallexScrollView.setParallexOffset(float) - this is the programatic version of the offset value.

Background The background will at the very minimum be the exact size as the parent (matches the ParallexScrollView size). If the ScrollView content is larger than the parent then background calculates a factor based on the scroll capacity, i.e. a parallexFactor of 0.5 will approximatly move the background at half the rate of the foreground scroll.

Foreground Make sure you fill the parent, I haven't overridden this but I may in the future if people have issues with it, as the background will scroll based on the size of foreground content.

Example Layout

<couk.jenxsol.parallaxscrollview.views.ParallaxScrollView xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:parallexOffset="0.25" >

    <!-- Background -->

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:scaleType="fitXY"
        android:src="@drawable/bg_sky" />

    <!-- Foreground -->
    <!-- You can place any of the items below as the foreground, but for most control, add the scroll view yourself. -->

    <couk.jenxsol.parallaxscrollview.views.ObservableScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:layout_width="260dp"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingBottom="@dimen/spacing"
            android:paddingTop="@dimen/spacing" >

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@android:color/white"
                android:padding="@dimen/spacing"
                android:text="@string/hello_world" />

        </LinearLayout>
    </couk.jenxsol.parallaxscrollview.views.ObservableScrollView>

</couk.jenxsol.parallaxscrollview.views.ParallaxScrollView>

Licence

Copyright 2012 Christopher Jenkins

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

Calligraphy

Custom fonts in Android the easy way...
Java
8,589
star
2

Paralloid

Paralloid - (Pah-rah-loid) The Android Parallax library - DEPRECATED.
Java
439
star
3

StaggeredGridView

Based of the google staggeredgridview that has been hidden from the ACL, this is an example based off of that.
Java
103
star
4

AndroidTimeLock

Will time lock a build and stop the user running it if its too old, useful for releasing dev builds.
Java
29
star
5

ScrollViewPager

ScrollView Pager that makes a ScrollView act like it has pages.
Java
18
star
6

KUPnP

"Kew-pin" is a lighter weight Kotlin based UPnP client, based on modern reactive principles.
Kotlin
16
star
7

KotlinPatterns

Some of my prefered ways to use Kotlin on Android
Kotlin
13
star
8

MultiTrack

MultiTrack the Tape replacement
Kotlin
13
star
9

coreos-elk

CoreOS ELK Setup
Shell
11
star
10

NodeSizer

NodeJS Image resizing proxy service
JavaScript
11
star
11

AutoComponent

Super lightweight lib that will generate a subcomponent.
Kotlin
9
star
12

DroidKaigi

Slides from DroidKaigi Layout Inflator talk.
6
star
13

lemmings

Low level test runner to run hundreds of emulators on a single machine in a preditable manner
Kotlin
5
star
14

Android-Talk-Demos

Set of presentations and demos for getting into android talk.
Java
4
star
15

AndroidMapLibrary

Android Lib for Google Maps Plugin to provide high performance mapping tools.
Java
4
star
16

wakemesleepme

Wake And Sleep Solution for RHoK
Java
3
star
17

LetsTalkAboutTypefaces

Slides and extras for a talk about Typefaces.
Java
3
star
18

Dagger-Dynamic-Features

How to use Dagger 2 and Android Dynamic features
Kotlin
2
star
19

SwimmingTimer

A Small little java program to help people in timing laps for a swimming Gala
Java
2
star
20

yakcov

Yet Another Kotlin COmpose Validation library
Kotlin
1
star
21

PepperElephant

Pepper Elephant is the collection of 25 years worth of shows history, songs, cast, crew, music and memories.
JavaScript
1
star
22

WaryOfDairy

WairyOfDairy NodeJS Backend.
JavaScript
1
star