I want to enable the navigating up function in the ActionBar and have followed the document about this at:http://developer.android.com/guide/topics/ui/actionbar.html
But when I check my app (on android 4.0), the app icon does not show up, instead only a left caret is shown.
I have checked the android manifest file, the java file and layout file, but still have no idea of how to get it work....
Here is the AndroidManifest.xml:
...
<activity
android:name="com.test.HelpActivity"
android:label="@string/help"
android:parentActivityName="com.test.HomeActivity"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
android:screenOrientation="portrait" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.test.HomeActivity" />
</activity>
...
And here is the Java code:
...
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
public class HelpActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_help);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
Thank you for help!
=====UPDATE=====
I did a few more testing, and here is what I got:
on an Android Emulator (2.3), it works perfect.
on an Android Emulator (4.1.2), it works perfect.
on an Android Emulator (4.0), it seems fine, but when I click the home/up button, nothing happens and logcat displays: bad parentActivityName 'HomeActivity' in manifest
on my phone (4.0.3), only left caret is displayed, yet navigation works fine.
on an Android Emulator (4.3), it works fine, but the focusable area becomes the app icon + app title. (That is when I press anywhere within this long area, it is highlighted and navigation up event is triggered)
I am now totally lost... Guess it could be some bug in certain android versions.