Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The android search bar is a mix of native and custom elements.</p> <p>The Layout used by the search bar can be found in the android source code at this path (for the 2.1 version I can on my hard drive):</p> <p>frameworks/base/core/res/res/layout/search_bar.xml</p> <p>You can found the detail of the layout below:</p> <pre><code>&lt;view xmlns:android="http://schemas.android.com/apk/res/android" class="android.app.SearchDialog$SearchBar" android:id="@+id/search_bar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:focusable="true" android:descendantFocusability="afterDescendants"&gt; &lt;!-- Outer layout defines the entire search bar at the top of the screen --&gt; &lt;LinearLayout android:id="@+id/search_plate" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingLeft="12dip" android:paddingRight="12dip" android:paddingTop="7dip" android:paddingBottom="16dip" android:background="@drawable/search_plate_global" &gt; &lt;!-- This is actually used for the badge icon *or* the badge label (or neither) --&gt; &lt;TextView android:id="@+id/search_badge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="2dip" android:drawablePadding="0dip" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="?android:attr/textColorPrimaryInverse" /&gt; &lt;!-- Inner layout contains the app icon, button(s) and EditText --&gt; &lt;LinearLayout android:id="@+id/search_edit_frame" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"&gt; &lt;ImageView android:id="@+id/search_app_icon" android:layout_height="36dip" android:layout_width="36dip" android:layout_marginRight="7dip" android:layout_gravity="center_vertical" /&gt; &lt;view class="android.app.SearchDialog$SearchAutoComplete" android:id="@+id/search_src_text" android:background="@drawable/textfield_search" android:layout_height="wrap_content" android:layout_width="0dip" android:layout_weight="1.0" android:paddingLeft="8dip" android:paddingRight="6dip" android:drawablePadding="2dip" android:singleLine="true" android:ellipsize="end" android:inputType="text|textAutoComplete" android:dropDownWidth="fill_parent" android:dropDownHeight="fill_parent" android:dropDownAnchor="@id/search_plate" android:dropDownVerticalOffset="-9dip" android:popupBackground="@android:drawable/search_dropdown_background" /&gt; &lt;!-- This button can switch between text and icon "modes" --&gt; &lt;Button android:id="@+id/search_go_btn" android:background="@drawable/btn_search_dialog" android:layout_width="wrap_content" android:layout_height="fill_parent" /&gt; &lt;ImageButton android:id="@+id/search_voice_btn" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginLeft="8dip" android:background="@drawable/btn_search_dialog_voice" android:src="@android:drawable/ic_btn_speak_now" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;/view&gt; </code></pre> <p>All the drawables and styles are also in the source code.</p> <p>To make exactly the same thing, you will have to copy the different elements in your own project.</p> <p>You may also have to have a look the different classes:</p> <ul> <li>SearchDialog.SearchBar</li> <li>SearchDialog.SearchAutoComplete</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload