Alexandru Circus
Alexandru Circus

Reputation: 5538

ActionBar not showing on android < 5.0

I switched from ABS to AppCompat and Material theme(for api 21 only)

<!--manifest: -->
<application
        android:theme="@style/AppStyle"

<-- values folder -->
<style name="AppStyle" parent="@style/AudioRecTheme">
<style name="AudioRecTheme" parent="@style/Theme.AppCompat.Light">

<!-- values-v21 folder-->
<style name="AudioRecTheme" parent="@android:style/Theme.Material.Light">

My activity:

public class AudioRecActivity extends FragmentActivity

The action bar is showing only in Android 5.0, but missing otherwise.

Upvotes: 0

Views: 770

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006674

First, either use appcompat-v7 or use built-in themes, not both for the same activity. Here, you are trying to use Theme.AppCompat.Light in some cases and Theme.Material.Light in others, which is not only unnecessary but AFAIK will not work. If you are going to use Theme.AppCompat.Light, do so for all API levels.

Second, if you are going to use appcompat-v7 and Theme.AppCompat.Light, you need to inherit from ActionBarActivity.

Upvotes: 6

Related Questions