0

I'm trying to do custom the ShareActionProvider. I have the normal view that you can get with the code of the Android Api, but I want that when I push the button I can view the icons with a background white and the icons in two columns. Check this link to see the image that I can get it (I want only two columns, not three)(http://www.google.co.uk/imgres?imgurl=http://2.bp.blogspot.com/-yyTE06oLZ80/UmAPGz6nWKI/AAAAAAAAPZ4/EW_ifnzgOJ4/s1600/share%252Bvia.png&imgrefurl=http://www.yourtechielibrarian.com/2013/10/pushbullet-serving-up-your-stuff-on.html&h=1600&w=1000&tbnid=W-JLGdsPzG0GmM:&zoom=1&docid=LxxnoO0bPmGaxM&ei=mtEFVfHzNYWE7gbaxICQBQ&tbm=isch&client=ubuntu&ved=0CCAQMygBMAE)

My code is the sample code of android api....

  @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate menu resource file.
        getMenuInflater().inflate(R.menu.menu_activity__articulo, menu);

        // Locate MenuItem with ShareActionProvider
        MenuItem item = menu.findItem(R.id.menu_item_share);

        // Fetch and store ShareActionProvider
//        mShareActionProvider = (ShareActionProvider) item.getActionProvider();

        mShareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_item_share).getActionProvider();
        mShareActionProvider.setShareIntent(getDefaultShareIntent());
        // Return true to display menu
        return super.onCreateOptionsMenu(menu);
    }

    /** Returns a share intent */
    private Intent getDefaultShareIntent(){
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(Intent.EXTRA_SUBJECT, "Hi, read me");
        intent.putExtra(Intent.EXTRA_TEXT, articulo.getEnlace());
        return intent;
    }

**xml file**

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/menu_item_share"
        android:showAsAction="ifRoom"
        android:title="Share"
        android:actionProviderClass=
            "android.widget.ShareActionProvider" />
</menu>
Simpson
  • 593
  • 5
  • 20

1 Answers1

0

You will need to write your own ActionProvider, perhaps forking ShareActionProvider as a starting point. There is no option with ShareActionProvider to do what you are asking.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491