Gastric floating tablets are a multifunctional dosage form with the merits of long-term gastric retention, sustained release and improved bioavailability though floating time and sustained release are usually not satisfied. Here we designed a novel gastric floating system by combining compressed tablets with 3D printed devices, wherein a riboflavin tablet was filled into a device. The table-filled device can be called a tablet-in-device (TiD) system. Commercial poly(lactic acid) filaments were used for fused deposition modeling (FDM) 3D printing of the body and cap of the device. Four types of TiD systems were prepared. The basic structures of them involved non-net, centrally symmetric double-net (including a peripheral sealed air-filled chamber and a centric net-on-both-sides chamber), single-net (including a sealed air-filled chamber on the top side and a net-on-one-side chamber on the bottom side), and eccentric double-net (including an eccentric net-on-both-sides chamber and an air-filled chamber). They were exquisitely designed after precise calculations of every chamber parameters according to the buoyant principle. All of them showed good floating ability, although only the latter two TiD systems were selected due to appropriate drug release. Compressed riboflavin tablets, consisting of riboflavin, lactose, hydroxypropyl methylcellulose (HPMC) and magnesium stearate, were prepared with the direct compaction method. All the tablets showed rapid drug release though the release was highly hindered by the devices in the TiD systems due to the barrier effect of devices and the tablet slurry formation. The single-net and double-net TiD systems achieved the cumulative release of 41% and 62% at 72 h, respectively, along with simultaneously well floating. In vivo long-term (>72 h) gastric floating function of TiD systems was further demonstrated on the rabbit models by the CT investigation. TiD systems are appropriate for oral administration of drugs with super long-term floating and controlled release in the gastric route.