Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text doesn't show up with android:textStyle="italic"

Tags:

android

Below is the XML I am using and when I use the android:textStyle="italic" attribute, the text doesn't show up. Basically any TextView with the style SummarySubtitle will not show up.

    <style name="SummarySubtitle" parent="@android:style/TextAppearance">
       <item name="android:layout_width">wrap_content</item>
       <item name="android:layout_height">fill_parent</item>
       <item name="android:gravity">right|center_vertical</item>
       <item name="android:layout_weight">1</item>
       <item name="android:paddingRight">6dp</item>
       <item name="android:textSize">12dp</item>
       <item name="android:textStyle">italic</item>
   </style>

   <?xml version="1.0" encoding="utf-8"?>
   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="fill_parent" android:layout_height="70dp"
       android:orientation="vertical">

       <LinearLayout android:id="@+id/summary_header"
           android:layout_width="fill_parent" android:layout_height="30dp"
           android:orientation="horizontal">

           <TextView android:id="@+id/summary_title" android:text="Title"
               style="@style/SummaryTitle"/>

           <TextView android:id="@+id/summary_subtitle"
               android:text="Subtitle " style="@style/SummarySubtitle"/>

       </LinearLayout>

       <LinearLayout android:id="@+id/summary_subheader"
           android:layout_width="fill_parent" android:layout_height="20dp"
           android:orientation="horizontal">

          <TextView android:id="@+id/summary_min" android:text="@string/min"
              style="@style/SummaryHeader"/>

          <TextView android:id="@+id/summary_max" android:text="@string/max"
              style="@style/SummaryHeader"/>

          <TextView android:id="@+id/summary_avg" android:text="@string/avg"
              style="@style/SummaryHeader"/>

      </LinearLayout>

      <LinearLayout android:id="@+id/summary_values"
          android:layout_width="fill_parent" android:layout_height="20dp"
          android:orientation="horizontal">

         <TextView android:id="@+id/summary_value_min"
             android:text="$0.00" style="@style/SummaryValue"/>

         <TextView android:id="@+id/summary_value_max"
             android:text="$0.00" style="@style/SummaryValue"/>

         <TextView android:id="@+id/summary_value_avg"
             android:text="$0.00" style="@style/SummaryValue"/>

     </LinearLayout>

 </LinearLayout>
like image 631
Rick Avatar asked Mar 08 '11 00:03

Rick


People also ask

How do you italicize text on Android?

Double tap the text you want to format. Tap Format, then choose a formatting option like bolding, italics, or changing the font color.

How do you BOLD and italicize text in XML?

Yes, just add android:textStyle="bold|italic" .

How do I bold text in Android XML?

How do I bold text in Android XML? Change Text Style of TextView to BOLD in XML Layout File textStyle attribute of TextView widget accepts on of these values: "bold" , "italic" or "normal" . To change the style to bold, you have to assign textStyle with "bold" .


1 Answers

All I found on the subject so far

http://groups.google.com/group/android-developers/browse_thread/thread/843376e298e95e14

Relevant quote: "Oh yeah, I have seen that too. But when you run your app, it renders correctly."

It doesn't show up on the layout's graphical representation but works correctly when you build and run the app.

like image 70
Sid Avatar answered Sep 18 '22 14:09

Sid