当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Notification text color in Galaxy S 2.3.3

问题描述:

I'm building a music app, which has an ongoing notification. I meet the text color problem of notifications on Galaxy S with 2.3.3. My code is:

in layout/notification.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>

in values-v9/styles.xml

<style name="NotificationText" parent="android:TextAppearance.StatusBar.EventContent" />

<style name="NotificationTitle" parent="android:TextAppearance.StatusBar.EventContent.Title" />

I thought the text will be switched to white-based since Galaxy S has a dark grey background, but it keeps showing black texts. But other apps handle it fine, so there should be a way to do.

Does anyone know how to get the "default status bar text color" on Galaxy S? Thank you!

网友答案:

I used

android:textColor="@android:color/primary_text_light"

There are is another way that uses android:textStyle. See Custom notification layouts and text colors

网友答案:

The best solution I have found so far is the answer by Gaks here for this question:

Custom notification layouts and text colors

However, it is not complete. It will return the color of the title text but not the details text.

分享给朋友:
您可能感兴趣的文章:
随机阅读: