Additional information after a few hours of testing this morning.
 An interesting quirk: the bar is born valid and stays valid even if you 
call ActionMode.invalidate(), which means you need an helper method to bind 
your data as onPrepareActionMode never gets called for me.

I have confirmed the layout is inflated in the ActionMode context bar. In 
device monitor, some of the Views I have inflated are indeed there. The 
ActionMode bar won't grow to accommodate the extra content required. It 
seems to me it would be just better for this to be fully integrated in the 
action bar, especially when CoordinatorLayout enters the picture however I 
don't recall any hint about the Action bar superceding ActionMode (which 
makes sense to me as they're different things).

I also fiddled a bit with various layout parameters but with basically no 
success.
I also cast a few references to their concrete types to better look at the 
real objects being passed but I don't see any way to make it work either.

An interesting test: I inflated a menu resource containing a single dummy 
item and put my real layout in it:

@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    mode.getMenuInflater().inflate(R.menu.npdsa_action_mode, menu);
    final MenuItem item = menu.findItem(R.id.npdsaAM_dummy);
    item.setActionView(R.layout.npdsa_ctx_device_action_mode);
    bind(item.getActionView()); // put data labels and numbers in there
    return true;
}

This still results in nothing being drawn, even though something is 
definitely there, the result is almost the same as using .setCustomView 
directly.


*The SDK should be updated to contain some samples about this.*

Nonetheless, I cannot afford to put more hours into those quirks so I'll be 
going back to menu + dialogs. This doesn't produce the smooth interactions 
I want but it's what I know I can do for sure so I'll cut it there.

I hope I'll be able to do what I wanted at some future version of my app 
and I'm still interested in hearing about more experiments.

Cordially,
Massimo

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/5c749665-f99a-492e-923a-f6f0f77821c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to