How to set placeholder in AutoCompleteTextView?

2 posts, 1 answers
  1. Benson
    Benson avatar
    3 posts
    Member since:
    Aug 2017

    Posted 31 Aug Link to this post

    Hi guys,

    Wondering how to set placeholder( like hint in textfield ) in AutoCompleteTextView? 

    I tried text, hint, but wont work.

    also, how to add an icon in the AutoCompleteTextView? like the magnifier in this example.

    http://docs.telerik.com/devtools/nativescript-ui/Controls/NativeScript/AutoCompleteTextView/overview

    Thanks a lot

    Ben

  2. Answer
    nikolay.tsonev
    Admin
    nikolay.tsonev avatar
    287 posts

    Posted 01 Sep Link to this post

    Hello,

    Thank you for contacting us. 
    At this time setting a hint text is not supported for RadAutoCompleteTextView component. Regarding that, I have logged new feature request here in the nativescript-ui-feedback repository.

    In the meantime default hint (placeholder) value for your text field in the AutoComplte (Android), could be set while following the below-attached code.

    First, we will need to access the loaded event of our RadAutoCompleteTextView and provide callback
    <au:RadAutoCompleteTextView loaded="onAutoCompleteLoaded" >
    Now in the code-behind file, we can access the native view and use the native method setText to assign a default value.
    export function onAutoCompleteLoaded(args) {
        var autocmp = args.object;
        var nativeTField = autocmp.android.getTextField();
      
        nativeTField.setHint("Enter Country Name"); // default placeholder (hint) value
      
    }


    Regards,
    nikolay.tsonev
    Progress Telerik
    Did you know that you can open private support tickets which are reviewed and answered within 24h by the same team who built the components? This is available in our UI for NativeScript Pro + Support offering.
Back to Top