Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8237317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:26:03+00:00 2026-06-07T19:26:03+00:00

My activity makes use of the ActionBar.setSubtitle function to display the currently displayed file

  • 0

My activity makes use of the ActionBar.setSubtitle function to display the currently displayed file system location’s full path. This means that the substring towards the end of the subtitle is more relevant than the beginning, so I thought I would override the ActionBar style to ellipsize text at the start, rather than the end, like so:

res/values/themes.xml

<style name="Theme.Holo" parent="android:Theme.Holo">
    <!-- Action bar styles -->
    <item name="android:actionBarStyle">@style/Widget.Holo.ActionBar</item>
</style>

res/values/styles.xml

<style name="Widget.Holo.ActionBar" parent="@android:style/Widget.Holo.ActionBar">
    <item name="android:subtitleTextStyle">@style/TextAppearance.Holo.Widget.ActionBar.Subtitle</item>
</style>

<style name="TextAppearance.Holo.Widget.ActionBar.Subtitle"
       parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle">
    <item name="android:ellipsize">start</item>
</style>

When I install this onto my ICS device (Nexus S), the text is still (incorrectly) ellipsized at the end. If I modify my version of TextAppearance.Holo.Widget.ActionBar.Subtitle to include an item for android:textSize, the subtitle’s text size does get altered accordingly, so it would seem as if I am poking around in the right style; I just can’t figure out why it’s not honouring my android:ellipsize override.

To put all this into a question format: how can I override, using styles/themes, the android:ellipsize property of the subtitle view in the ActionBar?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:26:06+00:00Added an answer on June 7, 2026 at 7:26 pm

    It seems to me that it’s not possible with themes and styles, but I’ve found a workaround to set ellipsize value in runtime.

    The most difficult is to find title (or subtitle) TextView, because the id of this view is in internal android package.

    So you need create stub class in your project

    package com.android.internal;
    
    public class R {
    
    public static final class id {
        public static int action_bar_title = 0;
        public static int action_bar_subtitle = 0;
    }
    
    }
    

    After that you need to find this view in code (I do this with the following code, it works both with sherlock and default actionbars)

    public class ActionBarUtils {
    
    public static TextView getActionbarTitle(Activity activity) {
    
        TextView title = (TextView) activity.findViewById(R.id.abs__action_bar_title);// for ActionBarSerlock
        if (title == null) title = (TextView) activity.findViewById(com.android.internal.R.id.action_bar_title);// for default action bar
    
        return title;
    }
    }
    

    Now you can set ellipsize value in activity code:

    getActionBarTitle().setEllipsize(TextUtils.TruncateAt.MIDDLE)
    

    PS:
    Make sure, that you call getActionBarTitle when title is visible (after setDisplayShowTitleEnabled(true) call), otherwise you’ll get NullPointerException.

    PPS:
    If you use proguard obfuscation, you should add in proguard.cfg:

    -keep class com.android.internal.R*{
        *;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My current activity class TimerAct.java makes use of a timer of 30secs. Upon the
In onCreate method of Activity, it binds to a remote service and makes use
I'm using robolectric to test an activity that makes use of Google Analytics. Unfortunately,
Possible Duplicate: Android Service makes Activity not responding I use service to synchronize data
I have an Activity that makes a remote server call and tries to populate
I've Forms Library in SharePoint 2007. I've created a custom workflow activity that makes
I have a system of actionbar Tabs with ABS. The first tab is a
I have an application which makes use of the default camera to take pictures
I have this code in 1 activity : mPrefs = getPreferences(MODE_PRIVATE); String access_token =
My application makes heavy use of the Text to Speech API . It is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.