Skip to main content

AutoCompleteTextInput

این المان مشابه با المان textInput است با این تفاوت که شما می توانید لیستی از پیشنهادات یا suggestion وارد کنید و در هنگام نوشتن حروفی از آن کلمه ، آن کلمه به کاربر پیشنهاد شود

شود.

 متن پیشنهادی به صورت آرایه در اتریبیوت suggestion قرار میگیرد.

در ادامه یک نمونه کد از AutoCompleteTextInput را مشاهده می کنید:

<page title="AutoCompleteTextInput" background="#FFFFFF" toolbarColor="#E64724" width="match_parent" height="match_parent"> 
  
<image src="http://162.55.105.137:8080/api/public/dl/a4Y26e4j" width="25" height="25" margin_left="-160" margin_top="50"></image>
  <text text="university:" textsize="17" textcolor="#E64724" margin_left="50" margin_top="-30"></text>
       <autocompletetextinput 
                       hint=id="لطفا نام دانشگاه خود را وارد کنید" width="match_parent" 
                        height="wrap_content" margin_top="35"in" suggestions="شهید بهشتی"[&quot;test1&quot;,&quot;t2&quot;,&quot;t3&quot;]">
</autocompletetextinput>
  
</page>

 آرایه شما باید escape شده باشد مثلا آرایه [ "a" , "b" , "c" ] به صورت زیر باید نوشته شود:

[&quot;a&quot;,&quot;b&quot;,&quot;c&quot;]

اجرای کد فوق به شکل زیر است :

 

image-1625636137616.jpg