开发者

Create a split control like the one in the Browser's address bar

开发者 https://www.devze.com 2022-12-23 05:02 出处:网络
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

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.imagesha开发者_如何学JAVAck.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

0

精彩评论

暂无评论...
验证码 换一张
取 消