第一步:在activity_main.xml文件中添加 LinearLayout布局、ImageButton标签
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#DCDCDC" tools:context=".MainActivity"> <LinearLayout android:id="@+id/imgb_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="@color/white" android:gravity="center_vertical" android:padding="10dp" android:orientation="horizontal"> <ImageButton android:id="@+id/imgb_device_state" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/white" android:src="@drawable/ic_baseline_devices_24" /> <ImageButton android:id="@+id/imgb_setting" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/white" android:src="@drawable/ic_baseline_settings_24" /> <ImageButton android:id="@+id/imgb_timelypreview" andro