android基础控件(1)TabHost实现选项卡
android基础控件(2)TabLayout+ViewPager实现选项卡
android基础控件(3)BottomNavigationView+FragmentLayout实现底层导航栏
android基础控件(4)GridView实现网格视图
android基础控件(5)Spinner实现下列列表框
android基础控件(6)Chronometer实现计时器
2.1 activity_main
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:background="#cfcfcf">
<com.google.android.material.tabs.TabLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:id="@+id/tab1"
app:tabMode="scrollable"
android:background="@color/colorPrimaryDark"/>
<androidx.viewpager.widget.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/vp1"/>
</LinearLayout>
2.2 Main_Activity
public class MainActivity extends AppCompatActivity {
private TabLayout tabLayout;
@Override
protected void onCreate