结合EditText和Button?

时间:2010-06-01 15:04:07

标签: android user-interface button android-edittext

在某些应用中,我看到EditText小部件与右侧的Button结合(例如search field in the twitter app)。 我该如何创建这样的小部件?

此致 马可

3 个答案:

答案 0 :(得分:3)

我终于找到了解决方案。 以下是谷歌人们的表现:search_bar.xml 谢谢你的帮助!

答案 1 :(得分:1)

Check out the TableLayout and the RelativeLayout in the Android developer center.

还有一些关于布局here的官方教程。

如果使用TableLayout,可以将EditText放在两列布局的左列中,然后将按钮放在右侧。或者,可能更好的方法是使用RelativeLayout,这会给你一点灵活性。

答案 2 :(得分:0)

查看Applying Styles and ThemesDraw 9-patch工具。 9-patches用作EditText和Button等小部件的背景。您可以将自定义窗口小部件背景与填充和边距组合以获得所需的效果。

相关问题