I have set up a custom title layout and cannot see the three bars for the action bar. I am using this app on a Samsung note 10.1 that does not have a hardware menu button. My parent is android:theme so I am not sure why the action bar is hidden. target version "16 minversion is "14"
Here is the manifest file setup with custom theme.
<application
android:allowBackup="true"
android:icon="@drawable/logo_icon"
android:label="@string/app_name"
android:theme="@style/CustomTheme">
This is the custom_title.xml to add items.
<resources>
<style name="CustomWindowTitleBackground">
<item name="android:background">#323331</item>
</style>
<style name="CustomTheme" parent="android:Theme">
<item name="android:windowTitleSize">45dip</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
</style>
This is the title.xml that makes up the custom title
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/image_icon"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="7dp"
android:src="@drawable/logo_icon" />
<TextView
android:id="@+id/Application"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text=" ColorMaker Simple RGB "
android:textSize="20dp" />
<!-- Bluetooth info -->
<TextView
android:id="@+id/textbluetooth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="BlueTooth: "
android:textSize="20dp" />
<ImageView
android:id="@+id/image_bt_on_off"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_gravity="center_vertical"
android:background="@drawable/circle" />
<!-- Network info -->
<TextView
android:id="@+id/textspacer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text=" | "
android:textSize="20dp" />
<TextView
android:id="@+id/textnetwork"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Network : "
android:textSize="20dp" />
<TextView
android:id="@+id/textspacer1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text=" | "
android:textSize="20dp" />
<!-- Fade info -->
<TextView
android:id="@+id/textfade_on_off"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Fade : "
android:textSize="20dp" />
<TextView
android:id="@+id/textspacer2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text=" | "
android:textSize="20dp" />
Menu item
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.simple_rgb__main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.title:
startActivity(new Intent(this, Prefrences.class));
// Activity2.this.startActivity(myIntent);
break;
}
return true;
}
Log error
11-24 17:47:54.593: D/AndroidRuntime(6607): Shutting down VM
11-24 17:47:54.593: W/dalvikvm(6607): threadid=1: thread exiting with uncaught exception (group=0x40d0f2a0)
11-24 17:47:54.601: E/AndroidRuntime(6607): FATAL EXCEPTION: main
11-24 17:47:54.601: E/AndroidRuntime(6607): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.simplergb/com.example.simplergb.SimpleRGB_Main}: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features
11-24 17:47:54.601: E/AndroidRuntime(6607): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2129)
11-24 17:47:54.601: E/AndroidRuntime(6607): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2154)
11-24 17:47:54.601: E/AndroidRuntime(6607): at android.app.ActivityThread.access$700(ActivityThread.java:146)
11-24 17:47:54.601: E/AndroidRuntime(6607): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1260)
11-24 17:47:54.601: E/AndroidRuntime(6607): at android.os.Handler.dispatchMessage(Handler.java:99)
11-24 17:47:54.601: E/AndroidRuntime(6607): at android.os.Looper.loop(Looper.java:137)
11-24 17:47:54.601: E/AndroidRuntime(6607): at android.app.ActivityThread.main(ActivityThread.java:4949)
11-24 17:47:54.601: E/AndroidRuntime(6607): at java.lang.reflect.Method.invokeNative(Native Method)
11-24 17:47:54.601: E/AndroidRuntime(6607): at java.lang.reflect.Method.invoke(Method.java:511)
11-24 17:47:54.601: E/AndroidRuntime(6607): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1043)
11-24 17:47:54.601: E/AndroidRuntime(6607): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
11-24 17:47:54.601: E/AndroidRuntime(6607): at dalvik.system.NativeStart.main(Native Method)
11-24 17:47:54.601: E/AndroidRuntime(6607): Caused by: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features
11-24 17:47:54.601: E/AndroidRuntime(6607): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:289)
11-24 17:47:54.601: E/AndroidRuntime(6607): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3118)
11-24 17:47:54.601: E/AndroidRuntime(6607): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3358)
11-24 17:47:54.601: E/AndroidRuntime(6607): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:314)
11-24 17:47:54.601: E/AndroidRuntime(6607): at android.app.Activity.setContentView(Activity.java:1920)
11-24 17:47:54.601: E/AndroidRuntime(6607): at com.example.simplergb.SimpleRGB_Main.onCreate(SimpleRGB_Main.java:169)
11-24 17:47:54.601: E/AndroidRuntime(6607): at android.app.Activity.performCreate(Activity.java:5185)
11-24 17:47:54.601: E/AndroidRuntime(6607): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
11-24 17:47:54.601: E/AndroidRuntime(6607): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2093)
11-24 17:47:54.601: E/AndroidRuntime(6607): ... 11 more