0

When I tried to add - android:layout_gravity inside android.support.design.widget.NavigationView There is neither any option inside the design mode & when I tried to write the code it was displaying incorrect

After researching I found that Android Studio does this sometimes. The answer is actually quite simple.

This is the .xml file

android:id="@+id/drawer_layout"

android:layout_width="match_parent"
android:layout_height="match_parent"

android:fitsSystemWindows="true">

<android.support.design.widget.NavigationView

    android:id="@+id/navigation_view"

    android:layout_width="wrap_content"
    android:layout_height="match_parent"

    android:layout_gravity="start"
    >


</android.support.design.widget.NavigationView>

  • Is this an answer or a question? – Leo Jul 23 '19 at 02:50
  • Its a question that has been answered by me :) I was stuck upon it for some hours, but later found that the answer was quite simple. But nobody has mentioned this over any platform – Justin Joseph Jul 30 '19 at 18:41

1 Answers1

0

This below method is quite simple and thus can be applied to various other same type of errors. Where you generally get confused is when you are typing the code it turns red, but do not stop. When you complete the line of code the compiler or Android Studio displays no error.

Actually this happens in Android Studio many a times. It doesn't provide the auto hints also it underlines the code in red. But only while typing. **

Once you complete the code the compiler accepts it

** :)