문제

I want to create a search box with the search button directly to the right of the EditText without any spacing, like how like the address bar on the internal browser application looks (see image below). Is this possible or do I need to create it myself?

Screenshot of the Android browser search bar http://img220.imageshack.us/img220/7338/gp2.png

도움이 되었습니까?

해결책

I think it'll take a bit of customization; you can look at the source here in the open source tree:

https://android.googlesource.com/platform/frameworks/base/+/froyo-release/core/res/res/layout/search_bar.xml

The relevant bits are:

<view ...
  ...
  android:background="@drawable/textfield_search"
  ...
/>

<Button 
  ...
  android:background="@drawable/btn_search_dialog"
  ...
/>

As you can see, it's using custom drawables (i.e. not @android:drawable...).

And yes, this can all be found using Hierarchy Viewer, as per Pentium10's response.

다른 팁

Use Hierarchy Viewer to get the view from the Internal Browser

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top