0

In my app I am using up navigation.

In newer Android apis, like Android 4.2, the up button is comprised by an arrow and the activity title, these two elements (arrow and activity title) look like a single button. But in older APIs, like Android 2.3, the up button is just the arrow, or the arrow and the icon, if you set a icon to the activity.

But my app does not have an icon in the activities, thus the user needs to click exactly in the arrow to perform up navigation, once the ub button is just the arrow. But this arrow is too small.

I'd like to make the activity title clickable too. That is, the up navigation in the older Android versions be the same as in the newer Android versions.

Someone know how to do this?

Thank you!

ps: In my manifest, each activity has this element:

android:icon="@android:color/transparent"

Thus, my app does not have an icon on the side of the up button arrow

androidevil
  • 9,011
  • 14
  • 41
  • 79

2 Answers2

0

Are you using (and handling) android.R.id.home?

@Override
public void onCreate(Bundle savedInstanceState) {
    ...
    getActionBar().setDisplayHomeAsUpEnabled(true);
}

And then

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home: // TODO

Source: http://developer.android.com/training/implementing-navigation/ancestral.html

Otherwise, please post some code.

Pedro Loureiro
  • 11,436
  • 2
  • 31
  • 37
  • Thank you for the answer. But I think you dont understand my question. In Android 2.3, to clik in the up button, the user have to click in the arrow (the button is just the arrow), and this arrow is too small. In newer Android verions, the up button is composed by the arrow and activity title. I'd like to reproduce this behavior in the older Android verions. Understand me? – androidevil Dec 10 '13 at 18:49
  • 1
    I agree, the arrow icon is stupid small when using `ActionBar.setIcon(R.color.transparent);`! – Someone Somewhere Apr 17 '14 at 19:29
0

It is simple as below:

actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(true);
Rajesh
  • 10,318
  • 16
  • 44
  • 64
gellyke
  • 730
  • 7
  • 14