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 9137759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:10:03+00:00 2026-06-17T09:10:03+00:00

While working with Titanium application, came across a situation where I want to change

  • 0

While working with Titanium application, came across a situation where I want to change image of Spinner (i.e. Picker in Titanium)

Taking Picker’s object I’m able to create spinner and manipulate data but not finding any mechanism which change the default image of spinner

Thinking to do like this replace-picker-with-button

any other idea?

  • 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-06-17T09:10:04+00:00Added an answer on June 17, 2026 at 9:10 am

    You can directly change image of the spinner by its backgroundImage property.

    For Example

    backgroundImage: '/images/dropdown.png.

    It will only work for Android and did not work with iPhone.

    So if you want to make same UI for both Ios and Android then you can follow below trick.

    Here is the global method which you can use to create and display Picker.

    /*
    pickerData: is the array of the values which you want to display in the picker
    funName: is the callback function which will be called when user will select the row from picker. this function will have two parameters first will be selected row's text and second is the index of the selected row
    title: is the title of the picker
    index: is the default selected index in the picker
    */
    
    function showPicker(pickerData, funName, title, index) {
        if (title == undefined || title == "") {
            title = "";
        }
        if (pickerData == undefined || pickerData == null) {
            pickerData = [];
        }
    
        index = index || 0;
    
        if (pickerData.length <= index || index < 0) {
            index = 0;
        }
    
        var selectedCategory = pickerData[0];
        var win = Ti.UI.createWindow({
            backgroundColor : 'transparent',
        });
    
    
        //Check weather the Os is IOs or Android
        //globals.isIos is the parameter which is indicating that current OS is IOs or not?
        if (globals.isIos) {
    
            var picker = Ti.UI.createPicker({
                selectionIndicator : true,
                bottom : 0,
                width : '100%',
                isSpinner : true,
            });
    
            data = [];
            for (var p = 0; p < pickerData.length; p++) {
                data.push(Ti.UI.createPickerRow({
                    title : pickerData[p],
                    index : p
                }));
            }
            picker.add(data);
            Ti.API.info("Tab Index" + index);
            picker.setSelectedRow(0, index, true);
    
            var selectedIndex = 0;
            picker.addEventListener('change', function(e) {
                selectedCategory = e.row.title;
                selectedIndex = e.row.index;
            });
    
            //toolbar
            var done = Titanium.UI.createButton({
                title : 'Done',
                style : Titanium.UI.iPhone.SystemButtonStyle.DONE,
            });
            done.addEventListener('click', function(e) {
                funName(selectedCategory, selectedIndex);
                win.close();
            });
    
            var title = Titanium.UI.createLabel({
                text : title,
                textAlign : 'left',
                color : 'white',
                font : {
                    fontWeight : 'bold',
                    fontSize : globals.isIpad ? 18 : "14dp"
    
                }
            });
            var flexSpace = Titanium.UI.createButton({
                systemButton : Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
            });
    
            var toolbar = Titanium.UI.iOS.createToolbar({
                items : [title, flexSpace, done],
                bottom : 216,
                borderTop : true,
                borderBottom : false,
                barColor : '#3F3F3F'
            });
    
            win.addEventListener('click', function(e) {
                win.close();
    
            });
    
            win.add(picker);
            win.add(toolbar);
            win.open();
        } else {
    
            var pickerView = Titanium.UI.createOptionDialog({
                selectedIndex : index
            });
            pickerView.title = title;
    
            data = [];
            for (var p = 0; p < pickerData.length; p++) {
                data.push(pickerData[p]);
            };
            pickerView.options = data;
            pickerView.addEventListener('click', function(e) {
                selectedCategory = pickerData[e.index >= 0 ? e.index : index];
                funName(selectedCategory, e.index >= 0 ? e.index : index);
    
            });
            pickerView.show();
        }
        return win;
    }
    

    Now create one button or lable inside your window and set the dropdown image to its background.
    So it will look like dropdown now handle click of the button and put below code in it.

    var data = ["Android", "IOS", "Blackberry", "Windows"];
    function callback(title, index) {
        Ti.API.info('Selected title=' + title + ' index=' + index);
    }
    
    var defaultSelected = 1;
    
    //Here functions is the global file in which my showPicker method is defined.
    var pickerShow = functions.showPicker(data, callback, "Mobile OS", defaultSelected);
    //Here globals is the file in which my isIos variable is defined.
    if (globals.isIos) {
        pickerShow.open();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While working over listView I have came across a trouble situation. Actually I am
While working my way through the Android tutorials, I came across something I don't
While working on an auditing project I came across different problems regarding software and
while working with an old initscript in redhat, I came across the line like
While working with JSP files and servlets , I came across <% … %>
While working on a project i came across a functionality in which i need
While working away on an old piece of code I came across something like
While working on jstree I came across this line of code- <!-- one of
While working on a project, I came across a JS-script created by a former
While working with some random sql queries on our databases, we may not want

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.