What to do when Layout Gravity not available/being suggested under any type of view

46 Views Asked by At

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>

1

There are 1 best solutions below

0
Justin Joseph On

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

** :)