回答
设置你的风格像
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item>
</style>
<!-- Style to replace actionbar overflow icon. set item 'android:actionOverflowButtonStyle' in AppTheme -->
<style name="MyActionButtonOverflow" parent="android:style/Widget.Holo.Light.ActionButton.Overflow">
<item name="android:src">@drawable/ic_launcher</item>
</style>
检查这个帖子:post
1)从您的menu.xml文件删除所有带有标签的项目。 这将从您的菜单区域删除三个点。
2)在XML中添加一个新的项目,并给予性质
android:icon="@drawable/image_you_want to show in the menu area"
app:showAsAction="always"
从菜单中删除这个项目。
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
visibility=false
android:title="@string/action_settings"/>
或者设置公开程度=假 – 2017-05-29 05:22:05
> for adding imageview and text
` <item android:id="@+id/action_cart"
android:icon="@drawable/cart2"
android:title="image"
app:showAsAction="always" />
<item
android:id="@+id/badge"
app:actionLayout="@layout/counter"
android:title="image"
android:icon="@drawable/shape"
app:showAsAction="always">
</item>`
In Layout counter
`<TextView
android:id="@+id/notif_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="20dp"
android:minHeight="20dp"
android:background="@drawable/shape"
android:text="0"
android:textSize="14sp"
android:textColor="#fff"
android:gravity="center"
android:padding="2dp"
android:singleLine="true">
</TextView>`
在布局计数器
1)关于删除三个点(阿迪亚-Vyas)首先解决的问题你的概率
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return false;
}
2)我们把图像视图 木箱菜单资源
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_submit"
android:title="@string/submit"
android:icon="@drawable/ask_price_back"
app:showAsAction="always" />
</menu>
Then declare onCrateOptionsMenu和onOptionsImtemSelected如下
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_submit, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_submit) {
//Your code to handle click
return true;
}
return super.onOptionsItemSelected(item);
}
3)处理从片段中的菜单在活动加载试试这个
覆盖在你的片段这种方法
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
getActivity().getMenuInflater().inflate(R.menu.menu_of_fragment, menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_fragment) {
// Your code to handle Click
}
return super.onOptionsItemSelected(item);
}
这里显示了什么? –
@Anu你能分享一下你的代码吗? –
先生,我已经分享了我的代码,你给我答案that.please看到https://stackoverflow.com/questions/44197429/how-to-set-images-and-text-in-toolbar-from-fragment- activities-in-android/44198871?noredirect = 1#comment75415354_44198871 – Anu
- 1. 如何删除工具栏下面黑暗栏上的导航抽屉
- 2. Android抽屉导航工具栏丢失
- 3. 如何在Android中的工具栏下设置导航抽屉?
- 4. 如何使片段覆盖工具栏中的导航抽屉
- 5. 如何删除导航抽屉图标
- 6. 抽屉式导航栏是工具栏下在Android中
- 7. 展开导航抽屉的动作栏/工具栏
- 8. 导航抽屉状态栏
- 9. 将工具栏与抽屉式导航栏连接
- 10. 获取导航抽屉滑动工具栏/操作栏下方
- 11. 在片段中使用导航抽屉和工具栏
- 12. 安卓工具栏图像居中与导航抽屉按钮
- 13. 安卓导航抽屉上的自定义工具栏
- 14. 导航抽屉涵盖我的工具栏
- 15. 带导航抽屉的透明工具栏
- 16. Android工具栏上的导航器抽屉
- 17. 工具栏采用全屏幕在Android的抽屉式导航
- 18. Android导航抽屉错误的工具栏标题onResume
- 19. 我可以从工具栏中删除汉堡包(抽屉导航图标),删除它的区域(矩形)吗?
- 20. 如何创建具有“抽屉外观”行为的导航栏
- 21. 抽屉式导航栏在多个activites工具栏实现最新的代码
- 22. 抽屉CoordinatorLayout和工具栏
- 23. 将导航抽屉链接到工具栏按钮
- 24. ImageView不会出现在导航抽屉工具栏
- 25. 导航抽屉使用Tablayout和折叠工具栏
- 26. 导航抽屉不工作
- 27. 导航抽屉
- 28. 如何在默认导航抽屉活动中实现工具栏?
- 29. 如何在导航栏下方放置导航抽屉?
- 30. 如何在使用导航抽屉的片段时在底部导航栏上添加导航抽屉?
请出示的截图什么你的意思是你试过的代码。包括一个问题,而你在这里,而不是一个请求 –
你的意思是工具栏? – erluxman
这可能会帮助你https://stackoverflow.com/questions/9206530/how-to-disable-hide-three-dot-indicatoroption-menu-indicator-on-ics-handsets – Nabin