0

My activity extends

public class MainActivity extends Activity {}

and my manifest contains

manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.connectingtonetwork"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="21" />

and my styles contains

<style name="AppBaseTheme" parent="@android:Theme.Holo>

still I cant see the action bar.my min sdk is 12 so according to developer guide I am using Theme.Halo.I hope someone can help me with this

krishna
  • 609
  • 8
  • 21

3 Answers3

1

You may want to inherit your MainActivity from ActionBarActivity

Also please look here for complete picture.

NeviQ-OR
  • 305
  • 2
  • 12
  • Thank you. Now I can see the action bar but I cant see the app icon and overflow button which shows the settings – krishna Nov 02 '14 at 03:51
  • I would need more info to answer. Does your manifest's section contain android:icon line? The other question: is your device equipped with hardware "settings" button? – NeviQ-OR Nov 02 '14 at 03:59
  • also I am testing on nexus 4 – krishna Nov 02 '14 at 04:04
  • On icon problem, I'd first try to work with style Theme.AppCompat.Light or similar and see how it goes, then if it's not working, just create template project under Android Studio - it allows picking from different activity templates, one of them is ActionBarActivity - and see how it works on the same device. On settings problem, I'd look into menu.xml first (to see menu item display parameters), and of course how the menu is inflated inside activity. – NeviQ-OR Nov 02 '14 at 04:20
  • This worked for me but went with extending AppCompatActivity since ActionBarActivity has been depreciated. – venom2124 Sep 18 '16 at 03:49
0

You can create a Custom design from you actionbar or you can set the icon in android manifest for each activity!

Usually you don't need inherit from ActionBarActivity, but you can inherit for a theme with a actionbar or use getActionbar().show() in you code :)

Links: How can I implement custom Action Bar with custom buttons in Android?

Good luck

Community
  • 1
  • 1
Thiago Souto
  • 761
  • 5
  • 13
  • Thank you :). I think the problem in my case is using eclipse.when I created the same project in android studio I could see the action bar – krishna Nov 02 '14 at 20:49
0

I figured out the problem(s) and it does not matter if you extends ActionBarActivity or Activity(using one of these depends on what min sdk version you are supporting) 1.I did not inflate the menu items 2.I did not use the correct theme for the activity.

krishna
  • 609
  • 8
  • 21