android - Dynamic Growing-Width AutoCompleteTextView -


first of all, first post here , i´m happy part of stackoverflow, finally. :d

i want build autocomplete-search button on right of autocompletetextview submit input string. button may have different widths, cuz of localization or custom texts ("search", "search now",...). want autocompletetextview growing dynamically on full until localized search button.

my current approch static , have change marginright depending on width of button:

<relativelayout android:id="@+id/layout" android:layout_width="fill_parent" android:layout_height="wrap_content">  <autocompletetextview android:id="@+id/searchtext" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginright="70dip" android:layout_alignparentleft="true"/>  <button android:id="@+id/btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="search" android:layout_alignparentright="true"/>  </relativelayout> 

is possible in android find dynamic solution?

with best wishes, jeff

yup, that's easy fix. you're close, remove marginright line, swap button , autocompletetextbox button (the item set width) defined first, set autocompletetextbox aligned toleftof button's id. trick!

<relativelayout      android:id="@+id/layout"      android:layout_width="fill_parent"      android:layout_height="wrap_content"     >          <button          android:id="@+id/btn"          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:text="search"          android:layout_alignparentright="true"         />             <autocompletetextview          android:id="@+id/searchtext"          android:layout_width="fill_parent"          android:layout_height="wrap_content"          android:layout_alignparentleft="true"         android:layout_toleftof="@id/btn"          /> </relativelayout> 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -