This is a migrated thread and some comments may be shown as answers.

How to set placeholder in AutoCompleteTextView?

1 Answer 403 Views
AutoCompleteTextView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Benson
Top achievements
Rank 1
Benson asked on 01 Sep 2017, 02:35 AM

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

1 Answer, 1 is accepted

Sort by
0
Accepted
Nikolay Tsonev
Telerik team
answered on 01 Sep 2017, 07:46 AM
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.
Tags
AutoCompleteTextView
Asked by
Benson
Top achievements
Rank 1
Answers by
Nikolay Tsonev
Telerik team
Share this question
or