using support library 21 to add material action bar.

This commit is contained in:
Kevin Meyer 2014-11-13 19:00:43 +01:00
parent d25265e781
commit 53ee178452
6 changed files with 9 additions and 15 deletions

View File

@ -80,6 +80,9 @@
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" />
</component>
</module>

View File

@ -20,5 +20,5 @@ android {
}
dependencies {
// compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.android.support:appcompat-v7:21.0.0'
}

View File

@ -5,9 +5,10 @@ import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.MenuItem;
public class BaseActionBarActivity extends Activity {
public class BaseActionBarActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -19,7 +20,7 @@ public class BaseActionBarActivity extends Activity {
protected void addBackButtonToActionBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
try {
getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
} catch (Exception e) {
//
}

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="app_theme" parent="android:Theme.Holo.Light"/>
<style name="mainActivity_theme" parent="android:Theme.Holo.Light" />
</resources>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="app_theme" parent="android:Theme.DeviceDefault.Light.DarkActionBar"/>
<style name="mainActivity_theme" parent="android:Theme.DeviceDefault.Light.NoActionBar" />
</resources>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="app_theme" parent="android:Theme.Light"/>
<style name="mainActivity_theme" parent="android:Theme.Light.NoTitleBar" />
<style name="app_theme" parent="Theme.AppCompat.Light.DarkActionBar"/>
<style name="mainActivity_theme" parent="Theme.AppCompat.Light.NoActionBar" />
</resources>