Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Considerações sobre Navigation Drawer e Effective Navigation

Considerações sobre Navigation Drawer e Effective Navigation

Slides da minhas apresentações no oitavo encontro do GDG-SP Android Meetup e na edição 2013 do TDC, em São Paulo.

Ubiratan Soares

October 01, 2013
Tweet

More Decks by Ubiratan Soares

Other Decks in Programming

Transcript

  1. <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> ! <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent"

    /> ! <ListView android:id="@+id/left_drawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:choiceMode="singleChoice" android:divider="@android:color/transparent" android:dividerHeight="0dp" android:background="#111"/> </android.support.v4.widget.DrawerLayout> activity_main.xml
  2. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ! mTitle

    = mDrawerTitle = getTitle(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mDrawerList.setAdapter(new MyAdapter(this, getSections()); ! mDrawerList.setOnItemClickListener(new ListView.OnItemClickListener { ! @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { setSection(position); // Trocar fragment de conteúdo aqui !!! } } // continua... DrawerActivity.java
  3. ! mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close

    ) { public void onDrawerClosed(View view) { getActionBar().setTitle(mTitle); invalidateOptionsMenu(); } ! public void onDrawerOpened(View drawerView) { getActionBar().setTitle(mDrawerTitle); invalidateOptionsMenu(); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); ! if (savedInstanceState == null) { setSection(0); } ! } //onCreate DrawerActivity.java
  4. OK

  5. OK

  6. “Se você possui uma árvore profunda no seu app, voltar

    ao topo da navegação com UP e BACK pode ser repetitivo e entediante. ! Se o Navigation Drawer for acessível de qualquer lugar do seu app, isso se torna mais rápido e eficiente.” GUIDELINES (IV)
  7. ACTIONBAR SPINNER FÁCIL ACESSO MAIS DE UM TIPO DE FILTRO

    NÚMERO MÁXIMO DE ITENS BOM USO DA ACTIONBAR