Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7496763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:46:18+00:00 2026-05-29T18:46:18+00:00

I am trying to configure the NumberPicker widget using API 14 . There are

  • 0

I am trying to configure the NumberPicker widget using API 14. There are very little tutorials or instructions online that would help me set it up properly.

so far I have the following code implemented in main.xml:

<NumberPicker
    android:id="@+id/numberPicker1"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:orientation="horizontal" />

and in the main activity in the onCreate() method:

NumberPicker np = (NumberPicker) findViewById(R.id.numberPicker1);
    String[] nums = new String[20];
    for(int i=0; i<nums.length; i++)
           nums[i] = Integer.toString(i);

    np.setMinValue(1);
    np.setMaxValue(20);
    np.setWrapSelectorWheel(false);
    np.setDisplayedValues(nums);
    np.setValue(1);

When running my application in the emulator the numberpicker widget does not get displayed as expected. The button’s are not left and right but up and down. And the values overlay each other instead of one number being displayed. Clicking an arrow crashes the application.

EDIT

Made changes as described below in first answer however the numberpciker is not usable, please see screenshot:

Numberpicker screenshot

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T18:46:27+00:00Added an answer on May 29, 2026 at 6:46 pm

    Try commenting out the for loop and the line np.setDisplayedValues(nums);. The NumberPicker should display the values for you automatically.

    You might also consider changing the width to android:layout_width="wrap_content" if you want the NumberPicker to display your values horizontally.


    EDIT:

    It appears that you cannot change NumberPicker (see this link). The issue is that you are trying to change the android:orientation attribute… but this is an inherited attribute from the LinearLayout class. You might be stuck with a vertically displaying NumberPicker unless you customize your own. Sorry!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to configure a dedicated server that runs ASP.NET to send mail through
I am trying to configure a network connection using ConfigurationManager.ProcessConfiguration, with the configuration file
We are trying to configure Spring JavaMailSender to work with Amazon's SES service using
I'm trying to configure Ehcache (version 2.5) such that it never forgets items. I'm
I've been trying to configure two separate Django apps on one server such that
We're trying to configure a server process so that, each time it receives a
I'm trying to configure a form for Zend_Form using Zend_Config_Ini, and wish to set
I'm trying to configure PyDev in eclipse, and as part of that I'm trying
I am trying to configure Zend Server CE based on the instructions in the
I'm trying to configure puppetmaster and puppet clients using Ubuntu 11.10 EC2 Instances (ami-a562a9cc).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.