一、xml布局文件:
添加TabHost控件
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout 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" tools:context=".MainActivity"> <TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent" tools:layout_editor_absoluteX="140dp" tools:layout_editor_absoluteY="253dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" and