我关注了ActionBarDrawerToggle GUIDE
而且我知道如何在 Action Bar 上使用 drawerImageRes
显示抽屉图标。
public ActionBarDrawerToggle (Activity activity, DrawerLayout drawerLayout, int drawerImageRes, int openDrawerContentDescRes, int closeDrawerContentDescRes)
The Activity hosting the drawer drawerLayout
The DrawerLayout to link to the given Activity's ActionBar
drawerImageRes A Drawable resource to use as the drawer indicator
openDrawerContentDescRes A String resource to describe the "open drawer" action for accessibility
closeDrawerContentDescRes A String resource to describe the "close drawer" action for accessibility
但是图标看起来好小
,
所以我想知道是否可以增加抽屉图标的大小?
请大家帮帮我,
谢谢,
最佳答案
实现了一个很好的答案,这是对 https://stackoverflow.com/a/40774724/3485872 的轻微调整
首先,您要创建一个自定义类,它扩展了创建汉堡包和导航图标的 Drawable 类。有多种方法可以更改其中任何一个的大小,但以下是控制汉堡包图标的方法。
public class HamburgerDrawable extends DrawerArrowDrawable{
public HamburgerDrawable(Context context){
super(context);
setColor(context.getResources().getColor(R.color.white));
}
@Override
public void draw(Canvas canvas){
super.draw(canvas);
setBarLength(30.0f);
setBarThickness(5.0f);
setGapSize(5.0f);
}
}
然后从您的类中调用它只需使用:
private void increaseHamburgerSize(){
mDrawerToggle.setDrawerArrowDrawable(new HamburgerDrawable(this));
}
关于android - 是否可以增加 ActionBarDrawerToggle(抽屉菜单)的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23896617/