1

I want to create a number picker in horizontal mode, but i set the android:orientation="horizontal", it still cannot work. How can i create the number picker in horizontal mode just like the pic below ?

enter image description here

<?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"
                tools:context="com.example.sam.weighttrack.KeyInWeightF">

    <LinearLayout
        android:id="@+id/payment2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal" >

        <NumberPicker
            android:id="@+id/numberPicker1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" />
    </LinearLayout>
</RelativeLayout>
Wg Sam
  • 61
  • 1
  • 2
  • 11

1 Answers1

2

NumberPicker does not support horizontal orientation. So you have to write your own or use one of few existed libraries:

  1. HorizontalPicker
  2. android-spinnerwheel
  • Im using android studio im asking for number picker in horizontal mode, but the HorizontalPicker is a tab lolz. Can u give an example of code so i can get understanding easily – Wg Sam Dec 07 '15 at 02:00
  • I also had to make my own, see here: http://stackoverflow.com/a/37704644/2102748 – milosmns Jun 08 '16 at 13:59