TtSearchView
A reusable SearchView where the appearance of the input field, the search icon and the close icon can be customized by theme attributes.
The client can specify whether TtSearchView will expand when activated by defining ttExpandedWidth. When ttExpandedWidth is set, TtSearchView will not accept any input even while focused and has to be expanded by tapping on it. After TtSearchView is expanded, it behaves as usual.
If ttExpandedWidth is set, and then dynamically changed back to 0.0f, TtSearchView will resize it's with to the one set in the XML file or provided by the set LayoutParams. If that width is too small for the TtSearchView to be usable, you have to manually adjust TtSearchView's width through updateLayoutParams. Note that it is only valid to update this view's width through updateLayoutParams while ttExpandedWidth is 0.0f. When TtSearchView is expandable, the LayoutParams will be updated automatically based on user interaction.
All theme attributes used by this control are declared in com.tomtom.tools.android.core.theme
. To use this control, it is mandatory to define these attribute values.
Parameters
The display context.
The attribute set provided in the layout XML file.
The default style attribute set. The default value is R.attr.tt_searchview_style
Constructors
Types
The state of the search view. The search view has difference appearance for each state, e.g. the visibility of the clear icon.
Properties
Inherited properties
Functions
This override is necessary in order to make sure tapping on any part of the SearchView will expand it if it's collapsed. Otherwise, child views would intercept the click and expanding would not work correctly.
Updates the view appearance according to the given state, such as the visibility of the clear icon, the search indicator etc.