Customise android search view
I have a search view that looks like the following
I want it to resemble the following
Following is the code
<SearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:iconifiedByDefault="false"
android:keyboardNavigationCluster="true"
android:queryHint="@string/search_teams"
android:textColor="@color/grey" />
I want to be able to left align and customize the query hint in the search view by changing the font. By default the text is center aligned, is there any way I can change that?
android android-layout searchview text-alignment android-search
add a comment |
I have a search view that looks like the following
I want it to resemble the following
Following is the code
<SearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:iconifiedByDefault="false"
android:keyboardNavigationCluster="true"
android:queryHint="@string/search_teams"
android:textColor="@color/grey" />
I want to be able to left align and customize the query hint in the search view by changing the font. By default the text is center aligned, is there any way I can change that?
android android-layout searchview text-alignment android-search
do you also want the speaker on the right?
– Kevin Kurien
Nov 14 '18 at 7:25
Yes, Also with the search view underlined
– A.S
Nov 14 '18 at 7:27
You can use a simple editText withdrawableStart
anddrawableEnd
– Nilesh Rathod
Nov 14 '18 at 7:28
SerachView
is a widget/container, which internally uses many other view like textview and several other views inside to form theSerachView
layout. What I would do is, read the SerachView class and find theTextView
being used and then get a reference to thatTextView
bysearchView.findViewById(serachviewTextViewId)
and then apply the property to theTextView
– Saran Sankaran
Nov 14 '18 at 7:29
add a comment |
I have a search view that looks like the following
I want it to resemble the following
Following is the code
<SearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:iconifiedByDefault="false"
android:keyboardNavigationCluster="true"
android:queryHint="@string/search_teams"
android:textColor="@color/grey" />
I want to be able to left align and customize the query hint in the search view by changing the font. By default the text is center aligned, is there any way I can change that?
android android-layout searchview text-alignment android-search
I have a search view that looks like the following
I want it to resemble the following
Following is the code
<SearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:iconifiedByDefault="false"
android:keyboardNavigationCluster="true"
android:queryHint="@string/search_teams"
android:textColor="@color/grey" />
I want to be able to left align and customize the query hint in the search view by changing the font. By default the text is center aligned, is there any way I can change that?
android android-layout searchview text-alignment android-search
android android-layout searchview text-alignment android-search
edited Nov 14 '18 at 7:27
A.S
asked Nov 14 '18 at 7:24
A.SA.S
261416
261416
do you also want the speaker on the right?
– Kevin Kurien
Nov 14 '18 at 7:25
Yes, Also with the search view underlined
– A.S
Nov 14 '18 at 7:27
You can use a simple editText withdrawableStart
anddrawableEnd
– Nilesh Rathod
Nov 14 '18 at 7:28
SerachView
is a widget/container, which internally uses many other view like textview and several other views inside to form theSerachView
layout. What I would do is, read the SerachView class and find theTextView
being used and then get a reference to thatTextView
bysearchView.findViewById(serachviewTextViewId)
and then apply the property to theTextView
– Saran Sankaran
Nov 14 '18 at 7:29
add a comment |
do you also want the speaker on the right?
– Kevin Kurien
Nov 14 '18 at 7:25
Yes, Also with the search view underlined
– A.S
Nov 14 '18 at 7:27
You can use a simple editText withdrawableStart
anddrawableEnd
– Nilesh Rathod
Nov 14 '18 at 7:28
SerachView
is a widget/container, which internally uses many other view like textview and several other views inside to form theSerachView
layout. What I would do is, read the SerachView class and find theTextView
being used and then get a reference to thatTextView
bysearchView.findViewById(serachviewTextViewId)
and then apply the property to theTextView
– Saran Sankaran
Nov 14 '18 at 7:29
do you also want the speaker on the right?
– Kevin Kurien
Nov 14 '18 at 7:25
do you also want the speaker on the right?
– Kevin Kurien
Nov 14 '18 at 7:25
Yes, Also with the search view underlined
– A.S
Nov 14 '18 at 7:27
Yes, Also with the search view underlined
– A.S
Nov 14 '18 at 7:27
You can use a simple editText with
drawableStart
and drawableEnd
– Nilesh Rathod
Nov 14 '18 at 7:28
You can use a simple editText with
drawableStart
and drawableEnd
– Nilesh Rathod
Nov 14 '18 at 7:28
SerachView
is a widget/container, which internally uses many other view like textview and several other views inside to form the SerachView
layout. What I would do is, read the SerachView class and find the TextView
being used and then get a reference to that TextView
by searchView.findViewById(serachviewTextViewId)
and then apply the property to the TextView
– Saran Sankaran
Nov 14 '18 at 7:29
SerachView
is a widget/container, which internally uses many other view like textview and several other views inside to form the SerachView
layout. What I would do is, read the SerachView class and find the TextView
being used and then get a reference to that TextView
by searchView.findViewById(serachviewTextViewId)
and then apply the property to the TextView
– Saran Sankaran
Nov 14 '18 at 7:29
add a comment |
1 Answer
1
active
oldest
votes
You need to specify Searchable Configuration in a separate xml file and set below properties
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_label"
android:hint="@string/search_hint"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" >
</searchable>
From documentation refer here for more options
You can add voice search functionality to your search dialog or widget
by adding the android:voiceSearchMode attribute to your searchable
configuration. This adds a voice search button that launches a voice
prompt.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295015%2fcustomise-android-search-view%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to specify Searchable Configuration in a separate xml file and set below properties
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_label"
android:hint="@string/search_hint"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" >
</searchable>
From documentation refer here for more options
You can add voice search functionality to your search dialog or widget
by adding the android:voiceSearchMode attribute to your searchable
configuration. This adds a voice search button that launches a voice
prompt.
add a comment |
You need to specify Searchable Configuration in a separate xml file and set below properties
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_label"
android:hint="@string/search_hint"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" >
</searchable>
From documentation refer here for more options
You can add voice search functionality to your search dialog or widget
by adding the android:voiceSearchMode attribute to your searchable
configuration. This adds a voice search button that launches a voice
prompt.
add a comment |
You need to specify Searchable Configuration in a separate xml file and set below properties
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_label"
android:hint="@string/search_hint"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" >
</searchable>
From documentation refer here for more options
You can add voice search functionality to your search dialog or widget
by adding the android:voiceSearchMode attribute to your searchable
configuration. This adds a voice search button that launches a voice
prompt.
You need to specify Searchable Configuration in a separate xml file and set below properties
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_label"
android:hint="@string/search_hint"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" >
</searchable>
From documentation refer here for more options
You can add voice search functionality to your search dialog or widget
by adding the android:voiceSearchMode attribute to your searchable
configuration. This adds a voice search button that launches a voice
prompt.
answered Nov 14 '18 at 7:36
Karan MerKaran Mer
4,83032864
4,83032864
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295015%2fcustomise-android-search-view%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
do you also want the speaker on the right?
– Kevin Kurien
Nov 14 '18 at 7:25
Yes, Also with the search view underlined
– A.S
Nov 14 '18 at 7:27
You can use a simple editText with
drawableStart
anddrawableEnd
– Nilesh Rathod
Nov 14 '18 at 7:28
SerachView
is a widget/container, which internally uses many other view like textview and several other views inside to form theSerachView
layout. What I would do is, read the SerachView class and find theTextView
being used and then get a reference to thatTextView
bysearchView.findViewById(serachviewTextViewId)
and then apply the property to theTextView
– Saran Sankaran
Nov 14 '18 at 7:29