【发布时间】:2011-05-19 02:04:19
【问题描述】:
首先,这是我在这里的第一篇文章,我很高兴最终成为 stackoverflow 的一员。 :D
我想用 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中是否可以找到动态解决方案?
带着最美好的祝愿, 杰夫
【问题讨论】: