android - How to set label for app, but empty for all activities? -


short , simple question:

i use actionbarsherlock library, , wish have app's label set string, yet activities have empty label unless specified otherwise.

i know can go on each activity , set label "" , there better solution? using styles ? i've tried putting :

<item name="android:label"></item> 

in there, didn't anything.


edit: fact is, reason, setting label of activities "" , change label of app on android versions (tested on galaxy s mini, android 2.3) , name "" too. how come? bug?


this bug on either android or launcher i've tested on.

it seems setting label activities "" (or @ least main one) sets name of app "" , label of application tag default value of of activities.

you can remove whole title bar putting <item name="android:windownotitle">true</item> in app theme. don't think should have title bar without title (unless on devices running 3.0 or higher, title bar becomes actionbar , has more functionality), it'll waste valuable space.

if developing on 3.0+, 2.3, add following elements theme:

<style name="apptheme" parent="appbasetheme">     <item name="android:actionbarstyle">@style/actionbar</item> </style>  <style name="actionbar" parent="@android:style/widget.actionbar">     <item name="android:displayoptions">showhome|uselogo</item> </style> 

edit:

styles.xml:

<resources xmlns:android="http://schemas.android.com/apk/res/android">      <style name="appbasetheme" parent="android:theme.holo">         <!-- base theme style elements -->     </style>      <style name="apptheme" parent="appbasetheme">         <!-- other style elements. -->         <item name="android:actionbarstyle">@style/actionbar</item>     </style>      <style name="appthemewithtitle" parent="apptheme">         <item name="android:actionbarstyle">@style/actionbarwithtitle</item>     </style>      <style name="actionbar" parent="@android:style/widget.actionbar">         <!-- other actionbar style elements. -->         <item name="android:displayoptions">showhome|uselogo</item>     </style>      <style name="actionbarwithtitle" parent="actionbar">         <item name="android:displayoptions">showhome|uselogo|showtitle</item>     </style>  </resources> 

androidmanifest.xml:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.themes"     android:versioncode="1"     android:versionname="1.0" >      <uses-sdk         android:minsdkversion="8"         android:targetsdkversion="16" />      <application         android:allowbackup="true"         android:icon="@drawable/ic_launcher"         android:label="@string/app_name"         android:theme="@style/apptheme" >         <activity             android:name="com.example.themes.activity1"             android:theme="@style/appthemewithtitle">             <intent-filter>                 <action android:name="android.intent.action.main" />                 <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>          <activity             android:name="com.example.themes.activity2" />         <activity             android:name="com.example.themes.activity3" />      </application>  </manifest> 

activity1 have title displayed activity2 , activity3 not.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -