It turns out the problem was that I did not set a background color in my layout XML file... If someone could explain to me why this fixes the problem, I would greatly appreciate it. Adding
android:background="#000000" to my main layout fixed it, though.