Four-dimensional-printed smart materials have a wide range of applications in areas such as biomedicine, aerospace, and soft robotics. Among 3D printing technologies, fused deposition molding (FDM) is economical, simple, and apply to thermoplastics. Cross-linked polyethylene (XLPE) forms a stable chemical cross-linking structure and shows good shape-memory properties, but the sample is not soluble or fusible, which makes it hard to be applied in FDM printing. Therefore, in this work, a new idea of printing followed by irradiation was developed to prepare 4D-printed XLPE. First, low-density polyethylene (LDPE) was used to print the products using FDM technology and then cross-linked by gamma irradiation was used. The printing parameters were optimized, and the gel content, mechanical properties, and shape-memory behaviors were characterized. After gamma irradiation, the samples showed no new peak in FTIR spectra. And the samples exhibited good shape-memory capabilities. Increasing the irradiation dose increased the cross-linking degree and tensile strength and improved the shape-memory properties. However, it also decreased the elongation at break, and it did not affect the crystallization or melting behaviors of LDPE. With 120 kGy of irradiation, the shape recovery and fixity ratios (Rr and Rf) of the samples were 97.69% and 98.65%, respectively. After eight cycles, Rr and Rf remained at 96.30% and 97.76%, respectively, indicating excellent shape-memory performance.