ShareAction图标问题上动作条大小ShareActionProvider-V7 [英] Size of ShareAction icon issue on ActionBar with ShareActionProvider-v7
问题描述
我是工作在我的老 ShareAction
我的动作条
键,这是工作,因为我更新了我的包上 SDK管理器
。我看到<一个href=\"http://developer.android.com/intl/pt-br/reference/android/support/v7/widget/ShareActionProvider.html\">this来自商务部的谷歌它说,
I was working around my old ShareAction
on my ActionBar
and it was working since I updated my Packages on SDK Manager
. I saw this doc from Google which says,
要在共享操作添加到您的活动,把 ShareActionProvider
中
应用栏的菜单资源。例如:
To add a "share" action to your activity, put a
ShareActionProvider
in the app bar's menu resource. For example:
和我添加相同的,不添加任何图标
:
And I've added the same without adding any Icons
:
<item android:id="@+id/action_share"
android:title="@string/share"
app:showAsAction="ifRoom"
app:actionProviderClass="android.support.v7.widget.ShareActionProvider"/>
我用的是:
app:actionProviderClass="Mypackagename.ShareActionProvider"
通过自定义的 ShareActionProvider
通过以下code.you可以看到它的这里。
With a custom ShareActionProvider
with the following code.you can see it here.
我看到一个黑客或把戏做到这一点(与 ShareActionProvider
-V4),一切都很好,因为我决定用 android.support .v7.widget.ShareActionProvider
。
I saw a hack or a trick to do that (with ShareActionProvider
-v4) and everything was good since I decided to use android.support.v7.widget.ShareActionProvider
.
所以,这是我目前code:
So, Here is my currently code:
<item
android:id="@+id/shareac"
android:title="@string/share"
app:actionProviderClass="android.support.v7.widget.ShareActionProvider"
app:showAsAction="always" />
我没有使用图标
,因为<一href=\"http://developer.android.com/intl/pt-br/reference/android/support/v7/widget/ShareActionProvider.html\">here该医生说,
你并不需要指定一个图标的,因为 ShareActionProvider
部件接受自己的外表和行为的照顾。但是,你这样做
需要与Android指定标题:标题,如果动作结束
在溢出菜单。
You do not need to specify an icon, since the
ShareActionProvider
widget takes care of its own appearance and behavior. However, you do need to specify a title with android:title, in case the action ends up in the overflow menu.
这里是我到目前为止已经完成的:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main_details, menu);
// Locate MenuItem with ShareActionProvider
MenuItem item = menu.findItem(R.id.shareac);
// Fetch and store ShareActionProvider
mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
Bundle extra = getIntent().getExtras();
String title = extra.getString("title");
Bundle extraurl = getIntent().getExtras();
String url = extraurl.getString("url");
shareIntent.putExtra(Intent.EXTRA_TEXT, "Check this new project from something : " + title + url);
shareIntent.setType("text/plain");
mShareActionProvider.setShareIntent(shareIntent);
return true;
}
所以,在这里我看到现在Android Studio中什么是1.5.1,
So, here what I see right now in Android Studio 1.5.1 Is,
如果运行和编译应用程序:
And if run and compile the app:
正如你所看到的, ShareAction
的规模实在是太多了。 (它违反了 MaterialDesign
指引我猜的)。
As you can see, the size of ShareAction
is too much. (It's violating the MaterialDesign
guideline I guess).
我忘记说了,我已经试过安卓图标=@的mipmap / ic_share
这是与我的previous方法/招工作。但是,从检查这个preVIEW AndroidStudio
:
I forgot to say, I've already tried android:icon="@mipmap/ic_share"
which that was working with my previous method/trick. But, check this Preview from AndroidStudio
:
在这里,编译后:
一切都没变!
所以,我的问题:这是一个错误或我在做什么错在这里。
So, my question: is that a bug or what am I doing wrong here?
Intent.createChooser
也没工作:从:<一href=\"http://stackoverflow.com/a/34797718/4409113\">http://stackoverflow.com/a/34797718/4409113
编辑:
最有趣的部分,我刚才看到了相同的设计,并从谷歌以下课程,并在该应用程序,他们已经把它称为同resutls 阳光 应用:
The most interesting part, i just saw the same design and the same resutls from Google on the following course and on that app which they've called it SunShine app:
课程:
<一个href=\"https://www.udacity.com//course/viewer#!/c-ud855/l-3961788738/m-4294896397\">https://www.udacity.com//course/viewer#!/c-ud855/l-3961788738/m-4294896397
推荐答案
好吧,作为ianhanniballake在 这篇文章 说,
Okay, As ianhanniballake at this post said,
在材料设计图标有 24dp
X 24dp
,如正确的反映
搜索查看
。然而, ShareActionProvider
尚未更新
材料设计默认情况下。的
Icons in material design are
24dp
x24dp
, as properly reflected by theSearchView
. However,ShareActionProvider
has not yet been updated to material design by default.
顺便说一句,我刚刚张贴到 code.google.com
的问题/报告,你可以在这里看到:
By the way, i've just posted a question/report to code.google.com
which you can see it here:
的http:// code .google.com / p /安卓/问题/细节?ID = 200335
http://code.google.com/p/android/issues/detail?id=200335
似乎默认图标为 24dp
X 24dp
,但它应该是这样的这样的:
It seems that default icon is 24dp
x 24dp
but it should be like this:
但现在,它是这样的:
似乎是一个bug,仍在等待接受或回答有关it.I'll更新这个职位,如果他们answered.7经过的天!
Seems to be a bug and still waiting for accepting or answering about it.I'll update this post if they answered.7 days passed!
更新:
最后,他们已经分配的缺陷到开发团队和变得可用,他们将更新这一问题的更多信息。
Finally, they've assigned the defect on to the development team and they will update this issue with more information as it becomes available.
非常感谢 ssingamc ... @ google.com
在谷歌作为支持。
答案可以在这里找到:的http:/ /$c$c.google.com/p/android/issues/detail?id=200335#c10
The answer is available here: http://code.google.com/p/android/issues/detail?id=200335#c10
如果任何更新或修正任何可用我会更新这个答案。
I will update this answer if any updates or any fixes was available.
更新: 的 HTTP://$c$c.google.com/p/android/issues/detail ID = 200335#C12
UPDATE: http://code.google.com/p/android/issues/detail?id=200335#c12
您好,开发团队固定的您举报的问题
并且将在未来的版本可用。谢谢
Hi, The development team has fixed the issue that you have reported and it will be available in a future build. Thanks
这篇关于ShareAction图标问题上动作条大小ShareActionProvider-V7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!