1.使用页面应当继承与AppCompatActivity
2.如果使用的时候出现如下报错:
java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
修改style如下:
<resources> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> </style> </resources>
时间: 2024-11-05 02:24:27