As a protective layer for the flexible solar cell, a flexible protective material should be of high transmittance, excellent ultraviolet (UV) resistance and mechanical property. Herein, a foldable transparent polyimide (PI) composite film assembled with the zirconium-based metal-organic frameworks (UiO-66-X, X = H, NH2, NO2) is prepared by the direct dispersion or in-situ growth methods. The results show that the transmittances of UiO-66-X@PI films (U@PI, NU@PI and OU@PI) prepared with the in-situ growth are higher than those of UiO-66-X/PI films prepared with the direct dispersion, and the former's mechanical properties are also better than those of the latter. This may be because that the UiO-66-X in the former are embedded into the PI matrix to construct multipoint bonding network. The U@PI exhibits stronger UV-resistance than the Pristine PI, NU@PI and OU@PI after 5000 equivalent sun hours (ESHs) UV irradiation. The attenuations of average transmittance and tensile strength for U@PI are 2.19 % and 18.68 %, respectively, which are only one half and one-third of those for the Pristine PI (4.59 % and 56.58 %), respectively. And the average transmittance of U@PI has been over that of the Pristine PI after 5000 ESHs UV irradiation. This may be because that the porous UiO-66 increases the UV transmission path and the electron-hole recombination center, thereby inhibits the destructive effect of UV.