简体   繁体   中英

Android Actionbar Menu Item Title shown in Tablet not in Phone

Menu.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      tools:context="com.kent.service.engg.controllers.CaseDetailsActivity">

    <item android:id="@+id/title_bar_home"
        android:icon="@drawable/action_home_icon"
        android:title="Home"
        app:showAsAction="ifRoom"  />

    <item android:id="@+id/title_bar_setting"
          android:icon="@drawable/action_settings_icon"
          android:title="Setting"
          app:showAsAction="ifRoom|withText"/>
</menu>

This code working fine in Tablet but it is not working in Phone.

 <item android:id="@+id/title_bar_setting"
      android:icon="@drawable/action_settings_icon"
      android:title="Setting"
      app:showAsAction="ifRoom|withText"/>

Here attribute value : "ifRoom" will neglate text if there is no space in actionbar of phone

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM