Java – Android navigationview cannot respond to the click event on the project
•
Java
I'm trying to add a Navigation view to my application, but for some reason, I can't make it respond to any click events on any of the items it contains
My activity_ main. The XML file is as follows:
In my mainactivity In Java, I have this code to create navigationview and its project selection listener:
This problem really puzzles me because I used the exact same code in my old application and it seems to work properly I am using Android SDK 22 and build tools 22.0 one
Solution
With the same problem, this is my solution
I add headerview to navigationview programmatically, so I already have navigationview
I called navigationview bringToFront();
This is the code snippet for the context
Here is this code snippet inch GitHub repo for my project
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码