我正在尝试将导航抽屉位置更改为从左侧填充的位,就像新的playstore图标一样。我试过添加填充。但它不起作用。任何人都可以暗示如何实现它。
尝试了这个但是没有用
ImageView view = (ImageView)findViewById(android.R.id.home);
view.setPadding(50, 0,0,0);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_drawer, // nav menu toggle icon
R.string.app_name, // nav drawer open - description for
// accessibility
R.string.app_name // nav drawer close - description for
// accessibility
)
答案 0 :(得分:0)
使用v7-support库来解决问题。感谢@tyczj。
import android.support.v7.app.ActionBarDrawerToggle;
private ActionBarDrawerToggle mDrawerToggle;
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
// nav menu toggle icon
R.string.app_name, // nav drawer open - description for
// accessibility
R.string.app_name // nav drawer close - description for
// accessibility
) {
@Override
public void onDrawerClosed(View view) {
toolbar.setTitle(mTitle);
// calling onPrepareOptionsMenu() to show action bar icons
supportInvalidateOptionsMenu();
}
@Override
public void onDrawerOpened(View drawerView) {
toolbar.setTitle(mDrawerTitle);
getSupportFragmentManager().popBackStackImmediate();
supportInvalidateOptionsMenu();
}
};