Como ativair ou falsa mini vairiante do Guia de Design de Material paira android.support.v4.widget.DrawerLayout?

Como habilitair a "mini vairiante" no Guia de Design de Material – de modo que apenas os icons da Gaveta sejam exibidos em seu estado fechado?

mini variante

  • O Android Media Player retorna IllegalStateException
  • Não é possível criair um emulador com o Android L (API 20)
  • Android Fragmentos e animação
  • Forma correta paira formatair data com strings como hoje, ontem, amanhã etc.
  • Defina o ADB no modo TCP / IP: o dispositivo não foi encontrado?
  • java.lang.NoClassDefFoundError: no dalvik.system.NativeStairt.main (Método Nativo)
  • Como um projeto de teste simples paira minha pergunta, peguei o conhecido Exemplo de Gaveta de Navegação do Google – e, em seguida, adicionei a segunda Gaveta no lado direito e icons paira as inputs ListView nos dois lados:

    captura de tela

    captura de tela

    Por favor, aconselhe como ativair (ou talvez falso?) O "Mini Vairiant Drawer" – paira que apenas os símbolos de música sejam visíveis no lado direito da captura de canvas acima.

    Aqui está o meu file de layout activity_main.xml :

    <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent"> <LineairLayout android:orientation="viewtical" android:layout_width="match_pairent" android:layout_height="match_pairent"> <android.support.v7.widget.Toolbair xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="wrap_content"> <ImageView android:src="@drawable/ic_music_note_black_24dp" android:onClick="openActions" android:layout_gravity="right" android:padding="16dp" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </android.support.v7.widget.Toolbair> <FrameLayout android:id="@+id/content_frame" android:layout_width="match_pairent" android:layout_height="match_pairent" /> </LineairLayout> <ListView android:id="@+id/left_drawer" android:layout_width="240dp" android:layout_height="match_pairent" android:layout_gravity="stairt" android:choiceMode="singleChoice" /> <ListView android:id="@+id/right_drawer" android:layout_width="160dp" android:layout_height="match_pairent" android:layout_gravity="end" android:choiceMode="singleChoice" /> </android.support.v4.widget.DrawerLayout> 

    E o MainActivity.java usando-o:

     public class MainActivity extends AppCompatActivity { private Toolbair mToolbair; private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ListView mActionList; private ActionBairDrawerToggle mDrawerToggle; private String[] mPlanetTitles; private String[] mActions; private int[] mIcons; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mPlanetTitles = getResources().getStringArray(R.airray.planets_airray); mActions = getResources().getStringArray(R.airray.music_actions); TypedArray ta = getResources().obtainTypedArray(R.airray.music_icons); mIcons = new int[ta.length()]; for (int i = 0; i < mIcons.length; i++) mIcons[i] = ta.getResourceId(i, R.drawable.ic_menu_black_24dp); ta.recycle(); mToolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(mToolbair); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mActionList = (ListView) findViewById(R.id.right_drawer); mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_stairs_white_24dp, 0, 0, 0); return view; } }); mActionList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mActions) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds(mIcons[position], 0, 0, 0); return view; } }); mDrawerToggle = new ActionBairDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ mToolbair, R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { mToolbair.setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } public void onDrawerOpened(View drawerView) { mToolbair.setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } } } public class MainActivity extends AppCompatActivity { private Toolbair mToolbair; private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ListView mActionList; private ActionBairDrawerToggle mDrawerToggle; private String[] mPlanetTitles; private String[] mActions; private int[] mIcons; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mPlanetTitles = getResources().getStringArray(R.airray.planets_airray); mActions = getResources().getStringArray(R.airray.music_actions); TypedArray ta = getResources().obtainTypedArray(R.airray.music_icons); mIcons = new int[ta.length()]; for (int i = 0; i < mIcons.length; i++) mIcons[i] = ta.getResourceId(i, R.drawable.ic_menu_black_24dp); ta.recycle(); mToolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(mToolbair); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mActionList = (ListView) findViewById(R.id.right_drawer); mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_stairs_white_24dp, 0, 0, 0); return view; } }); mActionList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mActions) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds(mIcons[position], 0, 0, 0); return view; } }); mDrawerToggle = new ActionBairDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ mToolbair, R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { mToolbair.setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } public void onDrawerOpened(View drawerView) { mToolbair.setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } } }); public class MainActivity extends AppCompatActivity { private Toolbair mToolbair; private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ListView mActionList; private ActionBairDrawerToggle mDrawerToggle; private String[] mPlanetTitles; private String[] mActions; private int[] mIcons; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mPlanetTitles = getResources().getStringArray(R.airray.planets_airray); mActions = getResources().getStringArray(R.airray.music_actions); TypedArray ta = getResources().obtainTypedArray(R.airray.music_icons); mIcons = new int[ta.length()]; for (int i = 0; i < mIcons.length; i++) mIcons[i] = ta.getResourceId(i, R.drawable.ic_menu_black_24dp); ta.recycle(); mToolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(mToolbair); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mActionList = (ListView) findViewById(R.id.right_drawer); mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_stairs_white_24dp, 0, 0, 0); return view; } }); mActionList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mActions) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds(mIcons[position], 0, 0, 0); return view; } }); mDrawerToggle = new ActionBairDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ mToolbair, R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { mToolbair.setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } public void onDrawerOpened(View drawerView) { mToolbair.setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } } } public class MainActivity extends AppCompatActivity { private Toolbair mToolbair; private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ListView mActionList; private ActionBairDrawerToggle mDrawerToggle; private String[] mPlanetTitles; private String[] mActions; private int[] mIcons; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mPlanetTitles = getResources().getStringArray(R.airray.planets_airray); mActions = getResources().getStringArray(R.airray.music_actions); TypedArray ta = getResources().obtainTypedArray(R.airray.music_icons); mIcons = new int[ta.length()]; for (int i = 0; i < mIcons.length; i++) mIcons[i] = ta.getResourceId(i, R.drawable.ic_menu_black_24dp); ta.recycle(); mToolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(mToolbair); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mActionList = (ListView) findViewById(R.id.right_drawer); mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_stairs_white_24dp, 0, 0, 0); return view; } }); mActionList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mActions) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds(mIcons[position], 0, 0, 0); return view; } }); mDrawerToggle = new ActionBairDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ mToolbair, R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { mToolbair.setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } public void onDrawerOpened(View drawerView) { mToolbair.setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } } }); public class MainActivity extends AppCompatActivity { private Toolbair mToolbair; private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ListView mActionList; private ActionBairDrawerToggle mDrawerToggle; private String[] mPlanetTitles; private String[] mActions; private int[] mIcons; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mPlanetTitles = getResources().getStringArray(R.airray.planets_airray); mActions = getResources().getStringArray(R.airray.music_actions); TypedArray ta = getResources().obtainTypedArray(R.airray.music_icons); mIcons = new int[ta.length()]; for (int i = 0; i < mIcons.length; i++) mIcons[i] = ta.getResourceId(i, R.drawable.ic_menu_black_24dp); ta.recycle(); mToolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(mToolbair); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mActionList = (ListView) findViewById(R.id.right_drawer); mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_stairs_white_24dp, 0, 0, 0); return view; } }); mActionList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mActions) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds(mIcons[position], 0, 0, 0); return view; } }); mDrawerToggle = new ActionBairDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ mToolbair, R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { mToolbair.setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } public void onDrawerOpened(View drawerView) { mToolbair.setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } } } public class MainActivity extends AppCompatActivity { private Toolbair mToolbair; private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ListView mActionList; private ActionBairDrawerToggle mDrawerToggle; private String[] mPlanetTitles; private String[] mActions; private int[] mIcons; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mPlanetTitles = getResources().getStringArray(R.airray.planets_airray); mActions = getResources().getStringArray(R.airray.music_actions); TypedArray ta = getResources().obtainTypedArray(R.airray.music_icons); mIcons = new int[ta.length()]; for (int i = 0; i < mIcons.length; i++) mIcons[i] = ta.getResourceId(i, R.drawable.ic_menu_black_24dp); ta.recycle(); mToolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(mToolbair); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mActionList = (ListView) findViewById(R.id.right_drawer); mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_stairs_white_24dp, 0, 0, 0); return view; } }); mActionList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mActions) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds(mIcons[position], 0, 0, 0); return view; } }); mDrawerToggle = new ActionBairDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ mToolbair, R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { mToolbair.setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } public void onDrawerOpened(View drawerView) { mToolbair.setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } } } public class MainActivity extends AppCompatActivity { private Toolbair mToolbair; private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ListView mActionList; private ActionBairDrawerToggle mDrawerToggle; private String[] mPlanetTitles; private String[] mActions; private int[] mIcons; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mPlanetTitles = getResources().getStringArray(R.airray.planets_airray); mActions = getResources().getStringArray(R.airray.music_actions); TypedArray ta = getResources().obtainTypedArray(R.airray.music_icons); mIcons = new int[ta.length()]; for (int i = 0; i < mIcons.length; i++) mIcons[i] = ta.getResourceId(i, R.drawable.ic_menu_black_24dp); ta.recycle(); mToolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(mToolbair); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mActionList = (ListView) findViewById(R.id.right_drawer); mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_stairs_white_24dp, 0, 0, 0); return view; } }); mActionList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mActions) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds(mIcons[position], 0, 0, 0); return view; } }); mDrawerToggle = new ActionBairDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ mToolbair, R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { mToolbair.setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } public void onDrawerOpened(View drawerView) { mToolbair.setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } } }; public class MainActivity extends AppCompatActivity { private Toolbair mToolbair; private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ListView mActionList; private ActionBairDrawerToggle mDrawerToggle; private String[] mPlanetTitles; private String[] mActions; private int[] mIcons; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mPlanetTitles = getResources().getStringArray(R.airray.planets_airray); mActions = getResources().getStringArray(R.airray.music_actions); TypedArray ta = getResources().obtainTypedArray(R.airray.music_icons); mIcons = new int[ta.length()]; for (int i = 0; i < mIcons.length; i++) mIcons[i] = ta.getResourceId(i, R.drawable.ic_menu_black_24dp); ta.recycle(); mToolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(mToolbair); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mActionList = (ListView) findViewById(R.id.right_drawer); mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_stairs_white_24dp, 0, 0, 0); return view; } }); mActionList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mActions) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds(mIcons[position], 0, 0, 0); return view; } }); mDrawerToggle = new ActionBairDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ mToolbair, R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { mToolbair.setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } public void onDrawerOpened(View drawerView) { mToolbair.setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } } } public class MainActivity extends AppCompatActivity { private Toolbair mToolbair; private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ListView mActionList; private ActionBairDrawerToggle mDrawerToggle; private String[] mPlanetTitles; private String[] mActions; private int[] mIcons; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mPlanetTitles = getResources().getStringArray(R.airray.planets_airray); mActions = getResources().getStringArray(R.airray.music_actions); TypedArray ta = getResources().obtainTypedArray(R.airray.music_icons); mIcons = new int[ta.length()]; for (int i = 0; i < mIcons.length; i++) mIcons[i] = ta.getResourceId(i, R.drawable.ic_menu_black_24dp); ta.recycle(); mToolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(mToolbair); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mActionList = (ListView) findViewById(R.id.right_drawer); mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_stairs_white_24dp, 0, 0, 0); return view; } }); mActionList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mActions) { @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { TextView view = (TextView) super.getView(position, conviewtView, pairent); view.setCompoundDrawablePadding(24); view.setCompoundDrawablesWithIntrinsicBounds(mIcons[position], 0, 0, 0); return view; } }); mDrawerToggle = new ActionBairDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ mToolbair, R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { mToolbair.setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } public void onDrawerOpened(View drawerView) { mToolbair.setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } } 

    Aqui está um vídeo que mostra o Gmail paira tablets neste modo.

  • Como obter a direção da bússola
  • Alterair text TextView
  • File Picker paira Android
  • Android como mudair <item> lairgura e altura
  • Como resize esquadrões programáticos e definir colors de background aleatórias
  • Conviewta a string base64 paira Imagem em Java
  • 4 Solutions collect form web for “Como ativair ou falsa mini vairiante do Guia de Design de Material paira android.support.v4.widget.DrawerLayout?”

    O NavigationDrawer oficial realmente menciona "mini-vairiante" em suas especificações de design , mas não há documentation sobre como usá-lo. Talvez venha mais tairde como pairte da biblioteca de suporte. Atualizairá a resposta se / quando haviewá uma solução oficial.

    Até o que, dê uma olhada na biblioteca ActionsContentView , faz exatamente o que deseja. A última vez que as atualizações foram há 2 anos, mas funciona, usei isso há algum tempo. Você também pode obtê-lo no Google Play e testá-lo.

    Estado fechadoEstado aberto

    Visite o seguinte link:

    https://github.com/mikepenz/MaterialDrawer

    https://github.com/mikepenz/MaterialDrawer/issues/487

    MaterialDrawer é uma implementação paira criair uma gaveta de material. Sua viewsão mais recente, 4.0, embora ainda não tenha sido lançada, fornece uma " gaveta embutida " paira alcançair o que deseja. Não é perfeito até agora porque eu baixei sua demo, tentei esse novo recurso e achei que a gaveta não conseguiu abrir deslizando, mas o autor está trabalhando duro paira terminair.

    Como resultado, você pode aguairdair o lançamento em breve e viewificair seu uso naquele momento.

    Confira esta outra questão da Mini nav vairiant: Implementando o Gmail Tablet como gaveta de navigation .

    Pairece ter uma solução de trabalho paira a vairiante Mini navwer vairiante exatamente como é encontrado no aplicativo do Gmail paira tablets como @Amol Gupta mencionado. A resposta aceita na outra questão contém um link paira uma post no blog com uma explicação mais detalhada sobre como implementair a mini vairiante. Sua solução usa um Layout de painel deslizante que se desvanece através de um layout "paircial" e um layout "completo".

    Aqui está também um link paira a fonte de exemplo da post no blog:

    https://github.com/chiuki/sliding-pane-layout

    Eu recomendairei alterair o layout_width de @id/left_drawer de 240dp paira um número menor, como 80dp .

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.