在父布局中加入
android:background="#000fff" android:focusable="true"即可
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.kasumi.basha.MainActivity" android:background="#000fff" android:focusable="true" android:focusableInTouchMode="true">