Как отобразить текст под значком в меню параметров? - PullRequest
0 голосов
/ 30 ноября 2018

Кто-нибудь имеет представление о том, как настроить пункт меню параметров ?.поэтому мне нужно изменить отображаемый текст под значком пункта меню параметров на панели инструментов.

Ответы [ 2 ]

0 голосов
/ 30 ноября 2018

Вы можете использовать настраиваемое действие Макет и поместить в меню. Элемент:

Вот XML для меню.

<menu 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:Eventapp="http://schemas.android.com/apk/res-auto">

<item
android:id="@+id/action_create"
android:actionLayout="@layout/action_view_details_layout"
android:orderInCategory="50"
android:showAsAction = "always"/>

</menu>

Макет

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/create"/>

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:src="@drawable/icon"/>

</LinearLayout>

это будетпоказывать значок и текст по вертикали.

0 голосов
/ 30 ноября 2018
Use Custom toolbar :-

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="@color/colorWhite"
    android:elevation="0dp"
    android:minHeight="?attr/actionBarSize"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:id="@+id/back_imageView"
            android:layout_width="@dimen/card_h"
            android:layout_height="@dimen/card_h"
            android:layout_centerVertical="true"
            android:contentDescription="@string/app_name"
            android:paddingBottom="@dimen/small_margin"
            android:paddingRight="@dimen/med_margin"
            android:paddingTop="@dimen/small_margin"
            android:src="@mipmap/back" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:orientation="vertical">


            <ImageView
                android:id="@+id/right_iv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/iv_dob"
                android:layout_gravity="center"
                android:contentDescription="@string/app_name" />

            <TextView
                android:id="@+id/first_textView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:fontFamily="@font/lato_bold"
                android:text="@string/app_name"
                android:textAllCaps="true"
                android:textColor="@color/colortext"
                android:textSize="@dimen/normal_text_size" />
        </LinearLayout>


    </RelativeLayout>
</android.support.v7.widget.Toolbar>
...