This paper proposes a novel safety-critical secondary voltage control method based on explicit neural networks (NNs) for islanded microgrids (MGs) that can guarantee any state inside the desired safety bound even during the transient. Firstly, an integrator is introduced in the feedback loop to fully eliminate the steady-state error caused by primary control. Then, considering the impact of secondary control on the stability of the whole system, a set of transient stability and safety constraints is developed. In order to achieve online implementation that requires fast computation, an explicit NN-based secondary voltage controller is designed to cast the time-consuming constrained optimization in the offline NN training phase, by leveraging the local Lipschitzness of activation functions. Specially, instead of using the NN as a black box, the explicit representation of NN is substituted into the closed-loop MG for transferring the stability and safety constraints. Finally, the NN is trained by safe imitation learning, where an optimization problem is formulated by maximizing the imitation accuracy and volume of the stable region while satisfying the stability and safety constraints. Thus, the safe and stable region is approximated that any trajectory initiates within will converge to the equilibrium while bounded by safety conditions. The effectiveness of the proposed method is verified on a prototype MG with detailed dynamics.