Android 在actionbar中创建带有文本的按钮

Android 在actionbar中创建带有文本的按钮,android,Android,目前我正在我的应用程序中显示这样的分数。但我想给这篇文章一些实质性的效果或背景,以改善外观和感觉。我想要这样的东西,有可能实现吗 <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item

目前我正在我的应用程序中显示这样的分数。但我想给这篇文章一些实质性的效果或背景,以改善外观和感觉。我想要这样的东西,有可能实现吗

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/scorePointsText"
        android:title="@string/scorePoints"
        app:showAsAction="always" />
    <item
        android:id="@+id/scoreBoard"
        android:icon="@drawable/main_score"
        android:title="@string/scorePoints"
        app:showAsAction="always" />
</menu> 
我使用上面的代码为操作栏充气


您可以在ImageView上添加一个文本视图,该视图为圆形,并放入AppBarLayout中。和工具栏上方。 像这样:

<android.support.design.widget.AppBarLayout
        android:theme="@style/Base.ThemeOverlay.AppCompat.Dark"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/textView"
            android:text="5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <ImageView
            android:id="@+id/Image_view"
            android:src="@drawable/circule"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar_single_poem"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways" />

    </android.support.design.widget.AppBarLayout>

试着像这样实现工具栏

 <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar_single_poem"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways" >

      <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "5"
            android:layout_gravity = "right"
            android:background = "@drawable/circle"/>
</android.support.v7.widget.Toolbar>

我只是举了一个例子,它可以是圆形的。我真正想做的是为这篇文章提供一些背景知识,以改善乐谱的外观和感觉。好的,我已经在讨论中描述过了。我对安卓非常陌生。如果这个qn浪费了你的时间,我很抱歉。虽然这个代码片段可以解决这个问题,但确实有助于提高你文章的质量。请记住,您将在将来回答读者的问题,这些人可能不知道您的代码建议的原因。