Tag Archives: SeekBar

Slide to Unlock Demo in Android

By | September 10, 2017

This is a simple demo to do Slide to Unlock in Android. Layout [xml] <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="20dp" tools:context="slide_unlock.coderzheaven.com.slidetounlockdemo.MainActivity"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:gravity="center" android:text="Slide to unlock" android:textStyle="bold" /> <SeekBar android:id="@+id/seekbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:max="100" android:progress="0" android:progressDrawable="@android:color/transparent" android:thumb="@drawable/hand" /> </RelativeLayout> [/xml] Activity [java] package slide_unlock.coderzheaven.com.slidetounlockdemo; import android.os.Bundle; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.widget.SeekBar;… Read More »

Custom SeekBar in Android With Labels in Bottom.

By | August 9, 2016

In this article I will be making a SeekBar as shown in the below screenshot. CustomSeekBar Class We will create a custom class for creating the custom Seekbar. I named it “CustomSeekBar.java” [java] package com.coderzheaven.customseekbar; import android.content.Context; import android.util.Log; import android.view.Gravity; import android.widget.LinearLayout; import android.widget.SeekBar; import android.widget.TextView; public class CustomSeekBar { int maxCount, textColor; Context mContext; LinearLayout mSeekLin;… Read More »

How to get the current progress on your SeekBar in android?

By | August 11, 2011

I have already shown how to use seekBar in android. This simple snippet helps you to get the current progress in the seekbar. It’s same code from this post, only thing is I added the getProgress method. [java] package com.coderzheaven; import android.app.Activity; import android.os.Bundle; import android.widget.SeekBar; import android.widget.TextView; public class SeekBarDemo extends Activity implements SeekBar.OnSeekBarChangeListener { SeekBar mSeekBar;… Read More »

How to use SeekBar in ANDROID?

By | June 21, 2011

Here is a simple example to show how to use seek Bar in android. Create a new project and place this code in it. [java] package com.coderzheaven; import android.app.Activity; import android.os.Bundle; import android.widget.SeekBar; import android.widget.TextView; public class SeekBarDemo extends Activity implements SeekBar.OnSeekBarChangeListener { SeekBar mSeekBar; TextView mProgressText; TextView mTrackingText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mSeekBar… Read More »