Search code examples
androidandroid-layouttitaniumtitanium-mobilesearchview

change SearchView hint Text and icon color in titanium


i'm using a search view for android but when the search view is empty it is difficult to see the icon of the search. so its difficult to now for the user what the box dues because the icons is white and the back ground has almost the same color.

this is my search view:

var search = Ti.UI.Android.createSearchView({
        top : (deviceHeight * 0.095) + 10,
        width : 300,
        height : 43,
        hintText : "Table Search",
        color : 'black',
        borderColor : 'black',
        borderRadius : 3,

    });

how can i change the hint text and icon color of the search view in titanium?

i'm not using the alloy folder


Solution

  • Try Ti.UI.createSearchBar in place of Ti.UI.Android.createSearchView

    var search = Ti.UI.createSearchBar({
        top : '100dp',
        width : '300dp',
        height : '43dp',
        hintText : "Table Search",
        hintTextColor : 'red',
        color : 'black',
        borderColor : 'black',
        borderRadius : 3,
        // value : 'def'
    });
    Window.add(search);
    

    In this you can provide the hintTextColor to searchbar.