ParallaxScrollView
==================
A Parallax ScrollView which takes a background and foreground view, in the ParallexScrollView.
Demo
----
Please download the [demo](https://github.com/chrisjenx/ParallaxScrollView/downloads).
Bakground image thanks to [shoptalklondon](http://shoptalklondon.com/sky-series-natural-gradients/).
Usage
-----
Look at the [demo](https://github.com/chrisjenx/ParallaxScrollView/downloads) 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
--------------
```xml
<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.
没有合适的资源?快使用搜索试试~ 我知道了~
小程序源码 ParallaxScrollView-master.zip
共25个文件
xml:10个
png:3个
java:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 36 浏览量
2023-03-19
20:26:44
上传
评论
收藏 1.39MB ZIP 举报
温馨提示
免责声明:资料部分来源于合法的互联网渠道收集和整理,部分自己学习积累成果,供大家学习参考与交流。收取的费用仅用于收集和整理资料耗费时间的酬劳。 本人尊重原创作者或出版方,资料版权归原作者或出版方所有,本人不对所涉及的版权问题或内容负法律责任。如有侵权,请举报或通知本人删除。
资源推荐
资源详情
资源评论
收起资源包目录
小程序源码 ParallaxScrollView-master.zip (25个子文件)
ParallaxScrollView-master
library
project.properties 584B
src
couk
jenxsol
parallaxscrollview
views
ParallaxScrollView.java 12KB
ObservableScrollView.java 1KB
libs
android-support-v4.jar 377KB
res
values
psv__attr.xml 220B
proguard-project.txt 781B
AndroidManifest.xml 279B
demo
project.properties 602B
src
com
jenxsol
parallaxscrollviewdemo
DemoActivity.java 2KB
libs
android-support-v4.jar 377KB
lint.xml 53B
res
drawable-mdpi
bg_sky.jpg 736KB
ic_launcher.png 5KB
drawable-xhdpi
ic_launcher.png 14KB
values-v14
styles.xml 380B
values-v11
styles.xml 323B
values
dimens.xml 104B
strings.xml 663B
styles.xml 679B
layout
activity_demo.xml 5KB
drawable-hdpi
ic_launcher.png 9KB
proguard-project.txt 781B
AndroidManifest.xml 929B
.gitignore 231B
README.md 4KB
共 25 条
- 1
资源评论
荣华富贵8
- 粉丝: 150
- 资源: 7649
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功