[英]how i can set SPACE between icon and title of Toolbar
i'm trying to change icon of Toolbar
when i select item
, already do this and works fin but title and icon Close together like this picture . 我正在尝试更改
Toolbar
图标,当我选择item
,已经这样做并且工作鳍但标题和图标像这张图片一样关闭。 i want to set space between them , any idea please ? 我想在它们之间设置空间,有什么想法吗?
public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.Fragment_art) {
final String art = "<font color='#ffd159'>Art</font>";
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.mipmap.art);
setTitle(Html.fromHtml(" Wallpapers : "+art));
} else if (id == R.id.Fragment_Material) {
final String Material = "<font color='#4acfd9'>Material</font>";
setTitle(Html.fromHtml(" Wallpapers : "+Material));
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.mipmap.material);
} else if (id == R.id.Fragment_Natural) {
final String Natural = "<font color='#49a010'>Natural</font>";
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.mipmap.natural);
setTitle(Html.fromHtml(" Wallpapers : "+Natural));
} else if (id == R.id.Fragment_Animal) {
final String Animal = "<font color='#e76541'>Animal</font>";
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.mipmap.animal);
setTitle(Html.fromHtml("Wallpapers : "+Animal));
}
尝试使用
setTitle(Html.fromHtml(" Wallpapers : "+art);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.