Can we use an edit text in action bar? After reading lot of resources in Google i could not find how to create an edit text in action bar. Can anyone tell me how do i do it?
You can set a custom View
for the ActionBar
like this:
getActionBar().setCustomView(R.layout.custom_actionbar);
You can then find Views
from the custom View
in the ActionBar
like this:
View actionBarView = getActionBar().getCustomView();
EditText editText = (EditText) acitonBarView.findViewById(R.id.editText);
Or you can just directly set a View
instance as custom View
like this:
EditText editText = new EditText(context);
getActionBar().setCustomView(editText);
Try this::
First url Second url
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With