Wednesday, 5 March 2014

How to make a vertical SeekBar in Android

Problem:

Okay. So I was trying to make a temperature control app for a college assignment and wanted create a vertical Seek Bar. This is the method I found to set a vertical seekbar in XML.

By default a seek bar is horizontal but if you add the following line of code in XML, it can become vertical.
android:rotation="270"
Unfortunately this works only if you are working with API 11 or higher. For lower APIs, I still haven't found a solution yet. Let me Know if you find any solution.

Solution:

<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" >

<SeekBar
    android:id="@+id/seekBar1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:rotation="270"
    />

</RelativeLayout>

Output:


 

Unknown

I am a Software Engineering Student and I love to code and develop apps. My weakness is that I am very lazy. Therefore I always Research and Develop.

0 comments:

Post a Comment

 

Copyright @ 2013 Abbasid.