Why is my actionbar not showing and how do I fix it?



Ok so I'm developing an Android app using Android Studio and I'm having real trouble getting the action bar to display. From the code, I cannot see why the action bar doesn't show. Can anyone spot what might be causing it?


Main Activity



public class HomeActivity extends Activity {

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

}


Main activty xml



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".HomeActivity"
>

<ListView
android:id="@+id/apps_list"
android:layout_width="match_parent"
android:layout_height="420dp"
android:divider="@color/divider"
android:layout_alignParentBottom="true"
>
</ListView>


My Manifest



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://ift.tt/nIICcg"
package="com.example.easylauncher" >

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".HomeActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:stateNotNeeded="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>

</manifest>


Styles xml



<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base"/>

<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->

<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">@color/primary</item>

<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">@color/primary_dark</item>



<item name="android:textColorPrimary">@color/primary_text</item>



<item name="android:icon">@color/icons</item>

<item name="android:divider">@color/divider</item>

<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">@color/accent</item>

<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight & colorSwitchThumbNormal. -->
</style>

</resources>

No comments:

Post a Comment