I try to finish my Toolbar
, but the icon size of whatever icon I use is a bit too large in comparison to the "settings"-dots as well as the search icon in my Toolbar
.
I tried to change the size manually with GIMP, however Android Studio still scales up the icons to the previous size.
Here is my XML for the menu:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:icon="@drawable/icon_notification_white"
android:id="@+id/sv_toolbar_main"
app:showAsAction="always"
app:actionViewClass="android.support.v7.widget.SearchView"
android:title="Search"
/>
<item
app:showAsAction="ifRoom"
android:id="@+id/iv_toolbar_main_notifications"
android:icon="@drawable/icon_add_notifier"
android:title="notifications"
/>
<item
android:id="@+id/toolbar_settings"
android:title="Settings"
app:showAsAction="never"
android:orderInCategory="1"/>
</menu>
and here is my relevant onCreate code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.inflateMenu(R.menu.main);
setSupportActionBar(toolbar);
In onCreateOptionsMenu I only made changes to the searchView in the toolbar:
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
mSearchViewToolbar = menu.findItem(R.id.sv_toolbar_main);
SearchView searchViewAction = (SearchView) MenuItemCompat.getActionView(mSearchViewToolbar);
searchViewAction.setIconifiedByDefault(true);
searchViewAction.setMaxWidth(Integer.MAX_VALUE);
searchViewAction.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String arg0) {
cursorFilter = !TextUtils.isEmpty(arg0) ? arg0 : null;
getSupportLoaderManager().restartLoader(ID_LOADER_MAIN, null, MainActivity.this);
return true;
}
});
return super.onCreateOptionsMenu(menu);
}
how can i adjust the size of an icon or increase the size of the other icons?