navigation-drawer

Navigation Drawer doesn't show fragments

做~自己de王妃 提交于 2019-12-02 15:12:27
问题 I've created a new Android Studio Project and my MainActivity is a Navigation Drawer Activity. So, I can't show up fragments. I've read many post on internet and here too. Explaining: I open navigation drawer, select menu "Podcast". PodcastsFragment should be shown, but it still showing activity. MainActivity code: import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android

navigation MenuItem in toolbar doesn't trigger onOptionsItemSelected

让人想犯罪 __ 提交于 2019-12-02 13:41:41
问题 I'm trying to use the navigation drawer with toolbar, but pressing the navigation button doesn't trigger the onOptionsItemSelected handler and the list doesn't open. Search button, however, trigger onOptionsItemSelected. This is my code and xml: EDIT: also onDrawerClosed() and onDrawerOpened() aren't called MainActivity.java: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mToolbar = (Toolbar)

Navigation drawer starts from right side

跟風遠走 提交于 2019-12-02 12:37:29
How can i make the navigation drawer open from the right to the left? Main.xml <android.support.design.widget.NavigationView android:id="@+id/navigation_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="end" app:headerLayout="@layout/drawer_header" app:menu="@menu/navigation" android:background="#FFE7FF"/> drawer_header.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="150dp" android:baselineAligned="false" android:orientation="vertical"> navigation.xml

ActionBarDrawerToggle with AppCompatActivity and Toolbar Back button with Fragments

风格不统一 提交于 2019-12-02 12:01:47
问题 I am using the ActionBarDrawerToggle with NavigationView. My content is displayed using fragments. I am following this stackoverflow question to get the back button press to work but control never flows to onOptionsItemSelected . This is my MainActivity.class: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer

Android Studio Navigation Draw Activity

孤人 提交于 2019-12-02 10:53:19
I am creating an App with a Navigation Draw Activity. In android studio, after I start a new android activity project, I select Navigation draw activity. My question is, how to a change the background color of the navigation draw activity? Right now, the top part is green but the white part where the text and icons are is white and I want to change this white part to dark grey with white text. Thanks. Rob Go to res -> layout -> activity_main.xml and add the following: <android.support.design.widget.NavigationView app:itemTextColor="#A9A9A9" // text color android:background="#FF0000" /> //

Control the Toolbar icon with NavigationDrawer

回眸只為那壹抹淺笑 提交于 2019-12-02 10:27:32
I'm currently using within my app the android.support.v7.widget.Toolbar and android.support.v4.widget.DrawerLayout . Everything is working right, but there is a slight thing I want to change its behaviour. When I open the drawer, the whole drawer occupies the space of the Toolbar . It would be nice that the Toolbar stays on top, like in the Google Music app . How can I achieve that? But the most important thing isn't the previous. At first, the icon which is loaded in the application is the three stripped one . I've realised that after opening the drawer, the icon changes to an arrow. And

Different NavigationDrawer items for Different activities in android

為{幸葍}努か 提交于 2019-12-02 10:07:52
Here i am using NavigationDrawer for my activities.It is working fine.i am using Recyclerview for displaying NavigationDrawer items. Now i want to display different NavigationDrawer Item for different Activity..Here i am using nav_drawer_labels in FragmentDrawer to display items.How to display nav_drawer_labels1 in another activity.I mean i have to display different NavigationDrawer in each activity..here is my code. CompProfileDisplay.java public class CompProfileDisplay extends AppCompatActivity implements OnItemClickListener, FragmentDrawer.FragmentDrawerListener { private static String TAG

How to set navigation drawer in preferenceActivity

拟墨画扇 提交于 2019-12-02 09:56:12
In my app i have each activity with drawer, but when i set drawer in my Preference activity, my activity working fine, but drawer not appear. here is my code.. public class SettingActivity extends PreferenceActivity implements NavigationView.OnNavigationItemSelectedListener { private AppCompatDelegate mDelegate; private NavigationView mDrawer; private DrawerLayout mDrawerLayout; private ActionBarDrawerToggle mDrawerToggle; @Override public void onCreate(Bundle savedInstanceState) { getDelegate().installViewFactory(); getDelegate().onCreate(savedInstanceState); getSupportActionBar()

Illegal Argument Exception - DrawerLayout must be measured with MeasureSpec.EXACTLY

时光怂恿深爱的人放手 提交于 2019-12-02 09:25:33
问题 Stacktrace: 09-10 07:56:56.448 24867-24867/? E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.IllegalArgumentException: DrawerLayout must be measured with MeasureSpec.EXACTLY. at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:814) at android.view.View.measure(View.java:15848) at com.android.internal.widget.ActionBarView.onMeasure(ActionBarView.java:1098) at android.view.View.measure(View.java:15848) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5012) at

Navigation Drawer doesn't show fragments

偶尔善良 提交于 2019-12-02 09:19:09
I've created a new Android Studio Project and my MainActivity is a Navigation Drawer Activity. So, I can't show up fragments. I've read many post on internet and here too. Explaining: I open navigation drawer, select menu "Podcast". PodcastsFragment should be shown, but it still showing activity. MainActivity code: import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.util.Log; import android.support.design.widget.NavigationView; import android.support.v4.view