This paper addresses the problem of voltage and reactive power control of inverter-based distributed generations (DGs) in an islanded microgrid subject to False Data Injection (FDI) attacks. To implement average voltage restoration and reactive power sharing, a two-layer distributed secondary control framework employing a multiagent system (MAS)-based dynamic consensus protocol is proposed. While communication network facilitates distributed control scheme, it leads to vulnerability of microgrids to malicious cyber-attacks. The adverse effects of FDI attack on the secondary controller are analyzed, and the necessary and sufficient conditions to model stealthy attack and probing attack are discussed in detail. A trust-based resilient control strategy is developed to resist the impacts of FDI attack. Based on the forward-backward consistency criterion, the self-monitoring and neighbor-monitoring mechanisms are developed to detect the misbehaving DGs. A group decision-making mechanism is also introduced to settle conflicts arising from the dishonest trust index caused by colluding attacks. A novel mitigation countermeasure is designed to eliminate the adversarial effects of attack: the discarding information mechanism is used to prevent the propagation of false data in the cooperative network while the recovery actions are designed to correct the deviations of collective estimation error in both transient disturbance and continuous FDI attack scenarios. Through a theoretical analysis, it is proved that the proposed mitigation and recovery mechanism can maintain the correct average estimates of voltage and reactive power, which ensures the secondary control objectives of microgrids under FDI attack. Simulation results on an islanded microgrid show the effectiveness and resilience of the proposed control scheme.