What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

I just tried to post a question containing the following text:

I'm building a music app, which has an ongoing notification. I meet the text color problem of notifications:

 1. On Galaxy S with Android 2.3.3, the notification background is black, and also the texts are. That makes Galaxy S users hard to read the texts.
 2. On Motorola Droid with Android 2.2.2, the notification background is white, and so the texts are. That also makes text hard to read.

My current code is: 

### Layout XML ###
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:orientation="vertical">

        <TextView android:id="@+id/notifbar_trackname"
            style="@style/NotificationTitle"
            android:focusable="true" android:singleLine="true"
            android:layout_gravity="left" android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <TextView android:id="@+id/notifbar_artist"
            style="@style/NotificationText"
            android:layout_gravity="left" android:scrollHorizontally="true"
            android:ellipsize="end" android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <TextView android:id="@+id/notifbar_queue"
            style="@style/NotificationText"
            android:layout_gravity="left" android:scrollHorizontally="true"
            android:ellipsize="end" android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </LinearLayout>

### styles.xml in values/ ###
    <style name="NotificationText">
        <item name="android:textColor">?android:attr/textColorPrimary</item>
    </style>
    <style name="NotificationTitle">
        <item name="android:textColor">?android:attr/textColorPrimary</item>
        <item name="android:textStyle">bold</item>
    </style>

### styles.xml in values/v9/ ###
    <style name="NotificationText" parent="android:TextAppearance.StatusBar.EventContent" />
    <style name="NotificationTitle" parent="android:TextAppearance.StatusBar.EventContent.Title" />

Does anyone know what's wrong in my code? Thank you!

When I try to confirm, the system says:

Oops! Your edit couldn't be submitted because:

Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon.

I totally have no idea what the system is complaining about. I have all code indented by 4 spaces.

Can anyone help?

share|improve this question
    
Your code appearing as code (fixed-width font, gray background, syntax highlighting) in the preview pane (below the editor) should be a good sign you've got it right... –  Shog9 Nov 28 '11 at 3:18
    
Irrelevant to your problem, but you don't need the last ### for the headings - the #s in front will do –  Yi Jiang Nov 28 '11 at 4:06

2 Answers 2

up vote 14 down vote accepted

Try inserting another line break between each heading and the start of its code snippet, so

### Layout XML ###
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:orientation="vertical">

becomes

### Layout XML ###

    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:orientation="vertical">

and so on.

share|improve this answer

Leave a blank line after each of the headings (the ###...### lines). Without it, the parser interprets those as part of the following code blocks.

While you're at it, I would suggest not making those headings at all. They'll be sufficiently distinguished from the code blocks (which have a grey background) that there's no need for them to also appear in bold.

share|improve this answer
    
Thank you very much, you and the answer above solved the problem. –  Romulus Urakagi Ts'ai Nov 28 '11 at 4:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .