It is natural to measure the observables from the Hamiltonian-based quantum dynamics, and its inverse process that Hamiltonians are estimated from the measured data also is a vital topic. In this work, we propose a recurrent neural network to learn the parameters of the target Hamiltonians from the temporal records of single-qubit measurements. The method does not require the assumption of ground states and only measures single-qubit observables. It is applicable on both time-independent and time-dependent Hamiltonians and can simultaneously capture the magnitude and sign of Hamiltonian parameters. Taking quantum Ising Hamiltonians with the nearest-neighbor interactions as examples, we trained our recurrent neural networks to learn the Hamiltonian parameters with high accuracy, including the magnetic fields and coupling values. The numerical study also shows that our method has good robustness against the measurement noise and decoherence effect. Therefore, it has widespread applications in estimating the parameters of quantum devices and characterizing the Hamiltonian-based quantum dynamics.