Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid custom TitleBar - hide text
    text
    copied!<p>I am using a titlebar with a background image in my android app.</p> <p>values/custom_styles.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;style name="TitlebarBackgroundStyle"&gt; &lt;item name="android:background"&gt;@drawable/titlebar&lt;/item&gt; &lt;/style&gt; &lt;style name="Theme.MyCustomTheme" parent="android:Theme"&gt; &lt;item name="android:windowTitleBackgroundStyle"&gt;@style/TitlebarBackgroundStyle&lt;/item&gt; &lt;item name="android:windowTitleSize"&gt;45dp&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>layout/titlebar.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="45dip" android:gravity="center_vertical"&gt; &lt;ImageView android:id="@+id/header" android:src="@drawable/titlebar" android:layout_width="wrap_content" android:layout_height="wrap_content"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>Manifest:</p> <pre><code>&lt;application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/Theme.MyCustomTheme"&gt; </code></pre> <p>This works pretty well so far.</p> <p>The only thing I'd like to do now is to hide the text on the titlebar ... </p> <p>I tried:</p> <pre><code>&lt;item name="android:textSize"&gt;0dp&lt;/item&gt; </code></pre> <p>but with no luck. Is there any way to set the transparency or some other property that would allow me to see the background image but not the text?</p> <p>thanks for your thoughts Ron</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload