Gravity View is an Android adaptation of Facebook instant articles. The concept behind the library is to utilize the motion sensors of an Android device and allow the end user to explore the product by rotating his device. It uses gyroscope motion sensor readings to scroll the image.
You can read more about Gravity View article here
Install Demo app or APK from Releases on your device and experience the gravity view.
- Android 3.0 or higher
dependencies {
compile 'co.gofynd.library:gravity-view:1.0'
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<ImageView
android:id="@+id/bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</HorizontalScrollView>
</RelativeLayout>
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
gravityView = GravityView.getInstance(this)
.setImage(bg, R.drawable.landingbg)
.center();
}
@Override
protected void onResume() {
super.onResume();
gravityView.registerListener();
}
@Override
protected void onStop() {
super.onStop();
gravityView.unRegisterListener();
}
boolean is_supported = gravityView.deviceSupported();
- Multiple image support
- Support for Non-Gyroscope devices using Accelerometer sensor
Any contributions are welcome! Please check the contributing guideline before submitting a new issue.
- Fahim Sakri
Copyright 2017 Shopsense Retail Technologies Pvt Ltd.
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.