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

user1353517

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://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" 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://schemas.android.com/apk/res/android"
    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>
Fahim

Extend your Activity with ActionBarActivity

public class HomeActivity extends ActionBarActivity{

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

    }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Why is IFormFile showing null, and how do I fix it?

Why is my while going in a infinity loop? How do I fix it?

Why are months in my date slicer repeating? How do I fix it?

Why is my dropdown list showing differently on phone than desktop and how can I fix it?

How do I fix floating CSS label always being active showing 'invalid input' in my form?

My ListView is showing the same item twice. How do I fix it?

If my OEMCP is set to 437 then why is my cmd.exe default codepage 932? and how do I fix this?

Why my output is "()" and how can i fix it?

How do I get ActionBar attribute in my class [android]

How do I fix my neomuttrc syntax?

How do I fix this ArrayIndexOutOfBoundsException in my hashtable?

How do I fix my FirebaseRecyclerAdapter on a fragment?

How do I fix plotting my boxplot?

Why is this code not working, How do i fix it?

Why does my 'for' loop break due to a boolean set-membership check, and how do I fix it?

Why does mongodb change my date formats to long number and how do I fix it?

Why does Bootstrap destroys my normal css layout and how do I fix it?

Why is the gutter padding not displaying in one of my Bootstrap webpage content block and how do I fix it?

Why are all my Homebrew packages suddenly "unlinked"; how do I fix that?

Why is my Selenium web browser closing automatically and how do I fix it?

Why is Typescript coercing my keyof type to a never type and how do I fix it?

Why are my 32bit OpenGL libraries pointing to mesa instead of nvidia, and how do I fix it?

Why's my FreeBSD OpenJDK port update failing (and how do I fix it)?

Why does my tool output overwrite itself and how do I fix it?

Why does decreasing the size of the renderer offset my click events - How do I fix this

Why do Safari and Firefox seem to incorrectly render my gradient and how can I fix it?

Why are my Firefox Menu Arrows Enlarged? How do I fix them?

Why does my DataGridView resist displaying the bottom data and how do I fix it?

Why is my form posting after ajax post? How do I fix this?