【发布时间】:2011-12-19 13:45:46
【问题描述】:
Android 中是否有 Google 搜索的代码? xml 布局对我来说就足够了。或者也许有可能在 EditText 的右侧添加一个按钮,就像在角落添加一个图标一样?谢谢
【问题讨论】:
-
你可以看到my answer here。将图标更改为右侧很容易。先自己试试。稍后我会在右侧添加另一个带有图标的 sn-p
标签: android search android-edittext
Android 中是否有 Google 搜索的代码? xml 布局对我来说就足够了。或者也许有可能在 EditText 的右侧添加一个按钮,就像在角落添加一个图标一样?谢谢
【问题讨论】:
标签: android search android-edittext
<LinearLayout
android:id="@+id/mainLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bar"//set back ground for total look
android:orientation="horizontal" >
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Your hint"
android:drawableRight="@drawable/search"//give your search icon
android:id="@+id/editBox"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageSpeak"
android:background="@drawable/iconSpeak"//icon for speak
/>
</LinearLayout>
【讨论】:
您有一个水平方向的 LinearLayout,您可以在其中有一个 EditText、一个带有搜索图像的 ImageView 和一个用于麦克风图像的 ImageView。所有这些都应该以这种方式切割所需的背景图像,以便看起来像一个。这是一般概念。
关于源代码,我帮不了你!
希望这会有所帮助!
【讨论】: