0
首先,這是我在這裏的第一篇文章,我很高興成爲最終的一部分。 :D動態增長寬度AutoCompleteTextView
我想要使用AutoCompleteTextView右側的按鈕構建一個AutoComplete-Search來提交輸入字符串。該按鈕可能有不同的寬度,本地化或自定義文本(「搜索」,「現在搜索」,...)。我希望AutoCompleteTextView能夠在整個範圍內動態增長,直到本地化的搜索按鈕。
我目前的計算策略是非常靜態的,我必須根據按鈕的寬度marginRight改變:
<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>
是否有可能在android系統找到一個動態的解決方案嗎?
有了良好的祝願, 傑夫
100%滿意答案! :D – Jeffo 2010-12-02 15:43:15