Note that there are some explanatory texts on larger screens.

plurals
  1. POActionBarSherlock (ABS): how to customize the text of action mode close item?
    primarykey
    data
    text
    <p>I'm using ABS vers. 4 and I need to simply change the default "Done" text that is displayed besides the action mode close icon, but I really can't figure out how to do it.</p> <p>I think that text needs to be customizable for at least two good reasons:</p> <ul> <li><p>"Done" is not appropriate for all contexts (e.g. "Cancel" could be more appropriate, and I've seen some apps, such as the "My Files" app on Galaxy Tab, use it)</p></li> <li><p>"Done" needs to be localized according to the user's language</p></li> </ul> <p>Is it possible to do customize that text? If so can anyone tell me how to do it? </p> <p>Thanks in advance.</p> <p><strong>EDIT</strong></p> <p>I've found a temporary workaround, that I post in the following:</p> <pre class="lang-java prettyprint-override"><code>private TextView getActionModeCloseTextView() { // ABS 4.0 defines action mode close button text only for "large" layouts if ((getResources().getConfiguration().screenLayout &amp; Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) { // retrieves the LinearLayout containing the action mode close button text LinearLayout action_mode_close_button = (LinearLayout) getActivity().findViewById(R.id.abs__action_mode_close_button); // if found, returns its last child // (in ABS 4.0 there is no other way to refer to it, // since it doesn't have an id nor a tag) if (action_mode_close_button != null) return (TextView) action_mode_close_button.getChildAt(action_mode_close_button.getChildCount() - 1); } return null; } </code></pre> <p>That's the method I came up with. Please <strong>NOTE</strong> that it does heavily rely upon the structure of the <code>abs__action_mode_close_item.xml</code> of ABS 4.0.</p> <p>This works for my scenario, but, as you can see, it cannot be considered sufficiently satisfying to promote it to a real "answer", that's why I only edited my previous post.</p> <p>Hope that helps someone else, but I also hope that someone could share a better and cleaner solution.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload