Ian M
Ian M

Reputation: 607

NumberPicker not displaying scroll controls

I have three NumberPickers defined in my app but none of them show scroll areas above the numbers - I only see the numbers themselves, with a horizontal bar above and below each. If I click on the areas above or below each horizontal bar (where I would expect the +/- scrolling controls to be) nothing happens. My layout XML is below. Any ideas??

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/group"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hours:" />

        <NumberPicker
            android:id="@+id/numberPickerHours"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Minutes:" />

        <NumberPicker
            android:id="@+id/numberPickerMinutes"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Seconds" />

        <NumberPicker
            android:id="@+id/numberPickerSeconds"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/group"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <ImageButton
            android:id="@+id/add"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="onClickStartTimer"
            android:src="@drawable/play" />
    </LinearLayout>

    <ScrollView
        android:id="@+id/scrollViewRecords"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textViewRecordCount"
        android:padding="5dip" >

        <LinearLayout
            android:id="@+id/linearLayoutRecords"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >
        </LinearLayout>
    </ScrollView>

</LinearLayout>

Upvotes: 0

Views: 1057

Answers (2)

Ian M
Ian M

Reputation: 607

I have now discovered the problem - I did not set Min and Max values for the NumberPickers - this effectively disabled the scrolling controls

Upvotes: 1

Hiemanshu Sharma
Hiemanshu Sharma

Reputation: 16

In Android 4.* the number picker is different. The layout shown in Eclipse is that of Android 2.3. The NumberPicker will still work, you can swipe up/down starting from the number shown in the middle.

http://www.fastcompany.com/multisite_files/fastcompany/imagecache/inline-large/inline/2012/10/3002577-inline-image-12.png shows them both.

Upvotes: 0

Related Questions