Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid SearchView not allowing typing (conflict with TabActivity?)
    text
    copied!<p>I am working on an application that uses a <code>SearchView</code> embedded in the <code>ActionBar</code>. It works perfectly across the app, except for in one <code>Activity</code>. In this <code>Activity</code>, I can click the search icon to display the search view across the action bar, but as soon as I type anything into the search view, my text input is ignored (no text is displayed), and focus moves away from the search box. </p> <p>The main difference between this activity and the others in my application is that this activity has tabs that are implemented using <code>TabActivity</code>. I am wondering if that is the cause, and if anyone has a potential solution. </p> <p>This is the code for the <code>SearchView</code>:</p> <pre><code>@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView(); searchView.setSubmitButtonEnabled(true); searchView.setOnQueryTextListener(queryTextListener); searchView.setQueryHint("product search"); return true; } final SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { return true; } @Override public boolean onQueryTextSubmit(String query) { _listControl = new ListControl(_thisProduct,query); _listControl.startGetData(); return true; } }; </code></pre> <p>This is the setup of my tabbed activity. Tabs switch between different views.</p> <pre><code> public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.product); //set up tabs mTabHost = getTabHost(); mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("Info").setContent(R.id.productLayout)); mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Specs").setContent(R.id.specLayout)); mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("Reviews").setContent(R.id.reviewLayout)); mTabHost.addTab(mTabHost.newTabSpec("tab_test4").setIndicator("Buy").setContent(R.id.textView4));// mTabHost.setCurrentTab(0); mTabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 40; mTabHost.getTabWidget().getChildAt(1).getLayoutParams().height = 40; mTabHost.getTabWidget().getChildAt(2).getLayoutParams().height = 40; mTabHost.getTabWidget().getChildAt(3).getLayoutParams().height = 40; </code></pre>
 

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