Using navigationdrawer with different activities

463 views
Skip to first unread message

Richard Lindhout

unread,
Jan 28, 2014, 3:34:31 PM1/28/14
to android-...@googlegroups.com
I want to make an app with different activities etc, but I want the navigation drawer along all activities

For example the timer activity, I personally think the navigation drawer should be available from all screens in the app. Do you maybe know how program such a thing.

I already know navigation drawer only works with fragments etc. but how to make a fragment acitivity with the same navigation drawer. (like google+)

ismet özöztürk

unread,
Jan 30, 2014, 9:53:38 AM1/30/14
to android-...@googlegroups.com

Richard Lindhout

unread,
Jan 30, 2014, 11:40:05 AM1/30/14
to android-...@googlegroups.com
I have fixed the fragment implentation as following

I added a linear layout to the carousel view so it became..

  <android.support.v4.view.ViewPager
            android:id="@+id/vp_pages"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

            <LinearLayout android:id="@+id/content_frame_inside"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/pager_background"
                android:orientation="vertical" >
            </LinearLayout>

On startup I make linearLayout invisible.

When a user clicks a normal item in the navigation drawer (not home) I make the pager invisible. and linearlayout visible

  ShowLinearLayout();
                pager.setVisibility(View.GONE);
                Fragment newFragment = new DeveloperFragment();
                FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
                                transaction.replace(R.id.content_frame_inside, newFragment);
                                transaction.commit();

All other fragments in app can be done like this.

When user clicks back to home i set linearlayout View.GONE and pager View.VISIBLE.
There should be more item implemented in navigation drawer so we can easily get it working with the needs of ours customer.

Oh, I didn't spend much time looking for grammar issues I'm not that good in English..



Richard Lindhout

--
You received this message because you are subscribed to a topic in the Google Groups "Android Bootstrap" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-bootstrap/Q8pVn3GXCh0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-bootst...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages