0

I am trying to rebuild the sample of this library:

https://github.com/umano/AndroidSlidingUpPanel

using Android Studio 1.5, however when it gets to "setSupportActionBar((Toolbar) findViewById(R.id.main_toolbar));" it throws an exception.

public class DemoActivity extends AppCompatActivity {
private static final String TAG = "DemoActivity";
private SlidingUpPanelLayout mLayout;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo);

    setSupportActionBar((Toolbar) findViewById(R.id.main_toolbar));

exception:

java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.sothree.slidinguppanel/com.sothree.slidinguppanel.demo.
DemoActivity}: java.lang.IllegalStateException:
This Activity already has an action bar supplied by the window decor.
Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to
false in your theme to use a Toolbar instead.

my styles.xml

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <item name="android:windowActionBar">false</item>
    <item name="colorPrimary">#ffff9431</item>
    <item name="colorPrimaryDark">#ffD56600</item>

I have windowActionBar set to false. I even tried to remove it, but it does not work.

I tried this thread but no success:

This Activity already has an action bar supplied by the window decor

any idea what is going on?

Community
  • 1
  • 1
gmmo
  • 2,577
  • 3
  • 30
  • 56
  • 1
    nevermind, this thread shows the proper fix: http://stackoverflow.com/questions/30923403/do-not-request-window-feature-action-bar-issue – gmmo Dec 10 '15 at 11:53
  • if u use toolbar than use Theme.AppCompat.NoActionBar in your style – Mayur Sakhiya Dec 10 '15 at 12:07

0 Answers0