Building a Ferris Wheel in Android is another best thing to do for beginner Android developers. With the help of dependency, you can be able to create the Ferris Wheel. Ferris Wheel is an Android library that is a unique way to represent data in the Animated form. In this article, we are going to see how to implement the Ferris Wheel in Android. Below is a sample GIF of the Ferris Wheel.
Application of Ferris Wheel
- The Ferris Wheel is a unique way of representing data or various options.
- This Ferris Wheel is used in most of the games built for children to learn to count, the alphabet in animated form. So that small children can gain interest in it.
- You can see this Ferris Wheel in the spin wheel game to earn rewards.
- This Ferris wheel can also be used to represent various options in circular list form.
Attributes of Ferris Wheel
Attribute | Description |
---|
fwv_cabinsNumber | Use to give the number of cabins on the wheel. |
fwv_isAutoRotate | The Wheel rotates automatically. |
fwv_isClockwise | The Wheel rotates in a clockwise direction. |
fwv_rotateSpeed | Use to give wheel rotation speed. |
fwv_cabinSize | Use to determine the size of the cabin. |
fwv_cabinFillColor | Use to give color to each cabin. |
fwv_startAngle | The angle at which the wheel starts rotating. |
fwv_wheelStrokeColor | To give color to the wheel. |
fwv_cabinLineStrokeColor | Cabin lines will be filled with colors. |
Step by Step Implementation
Step 1: Create a New Project
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio.
Step 2: Add dependency of the library in build.gradle file
Navigate to gradle scripts and then to build.gradle(Module) level. Add below line in build.gradle file in the dependencies section.
implementation 'ru.github.igla:ferriswheel:1.2'
After adding dependency click on the “sync now” option on the top right corner to sync the project.
Step 3: Working with the activity_main.xml file
Go to the activity_main.xml file and refer to the following code. Below is the code for the activity_main.xml file.
Java <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <ru.github.igla.ferriswheel.FerrisWheelView android:id="@+id/ferrisWheelView" android:layout_width="300dp" android:layout_centerInParent="true" android:layout_height="300dp" android:layout_gravity="center" app:fwv_cabinsNumber="8" app:fwv_rotateSpeed="10" /> </RelativeLayout>
Output:
Similar Reads
WheelView in Android In this article, WheelView is added in android. WheelView provides a very impressive UI that allows the developer to create a Wheel and add items according to his need. Some important tags provided by WheelView are wheelArcBackgroundColor, wheelAnchorAngle, wheelStartAngle, wheelMode, wheelCenterIco
3 min read
What is an Android Emulator? The Android SDK provides a virtual mobile device emulator that runs on a computer. An android emulator is used for executing, debugging, and testing android applications. The emulator helps the developer to run a trial product virtually without an actual hardware device. An emulator is similar to a
3 min read
Getting Started with Android Things Basically, Android Things refers to the summation of Android and the Internet of Things. IoT is very autonomous it means the Internet of Things, whatever the IoT device is, it can sense through sensors and do its respective task without very much human interaction and Android Things revolves around
4 min read
Interesting Facts About Android Android is a Mobile Operating System that was released on 23, September 2008. Android is free, open-source operating system and is based on modified version of Linux kernel. Open Handset Alliance (OHA) developed the Android and Google commercially sponsored it. It is mainly designed for touchscreen
3 min read
Android Tutorial In this Android Tutorial, we cover both basic and advanced concepts. So whether you are a fresher (graduate) or an experienced candidate with several years of Android Development experience, you can follow this Android tutorial to kick-start your journey in Android app development. Our Android Tutor
15+ min read