如何删除搜索视图折叠中的箭头?
How to remove arrow in searchview collapse?
我只是将 searchView 放在工具栏上,但是当我折叠 searchView 时我遇到了问题我得到了我在这张照片中提到的箭头..searchview 在菜单文件夹中..所以请提供一些关于如何删除此箭头的建议.. ....提前致谢
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.play.findnearplace.MainActivity" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never"/>
<item android:id="@+id/action_search"
android:title="@string/action_search"
android:icon="@drawable/search"
app:showAsAction="always|collapseActionView"
app:actionViewClass="android.support.v7.widget.SearchView" />
</menu>
MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
searchView.setSubmitButtonEnabled(true);
searchView.setOnQueryTextListener(this);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
@Override
public boolean onQueryTextChange(String newText) {
// TODO Auto-generated method stub
if (TextUtils.isEmpty(newText))
{
filter.filter("");
}
else
{
filter.filter(newText.toString());
}
return true;
}
@Override
public boolean onQueryTextSubmit(String arg0) {
// TODO Auto-generated method stub
return false;
}
删除此行以摆脱那个箭头:
searchView.setSubmitButtonEnabled(true);
查看 searchView 的文档submit button
我只是将 searchView 放在工具栏上,但是当我折叠 searchView 时我遇到了问题我得到了我在这张照片中提到的箭头..searchview 在菜单文件夹中..所以请提供一些关于如何删除此箭头的建议.. ....提前致谢
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.play.findnearplace.MainActivity" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never"/>
<item android:id="@+id/action_search"
android:title="@string/action_search"
android:icon="@drawable/search"
app:showAsAction="always|collapseActionView"
app:actionViewClass="android.support.v7.widget.SearchView" />
</menu>
MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
searchView.setSubmitButtonEnabled(true);
searchView.setOnQueryTextListener(this);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
@Override
public boolean onQueryTextChange(String newText) {
// TODO Auto-generated method stub
if (TextUtils.isEmpty(newText))
{
filter.filter("");
}
else
{
filter.filter(newText.toString());
}
return true;
}
@Override
public boolean onQueryTextSubmit(String arg0) {
// TODO Auto-generated method stub
return false;
}
删除此行以摆脱那个箭头:
searchView.setSubmitButtonEnabled(true);
查看 searchView 的文档submit button