Вопрос

I am trying to get a custom notification to work and although I have no issues with android 4.0 and upwards, I cannot get it to work correctly in 2.3.3 (API v10). Below is the result that I have: Incorrectly displaying notification

As you can see the text is not visible, neither is the progress bar.

Below is the XML used for the RemoteView:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ongoing_notif_layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dp" >

    <ImageView android:id="@+id/ongoing_notif_image"
        android:contentDescription="@string/notif_contentDesc"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_marginRight="10dp"
        android:textAppearance = "@android:style/TextAppearance.StatusBar.EventContent" />/>

    <TextView android:id="@+id/ongoing_notif_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/ongoing_notif_image"
        android:textAppearance = "@android:style/TextAppearance.StatusBar.EventContent" />

    <TextView android:id="@+id/ongoing_notif_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/ongoing_notif_image"
        android:layout_below="@id/ongoing_notif_title" 
        android:textAppearance = "@android:style/TextAppearance.StatusBar.EventContent" />

    <ProgressBar
        android:id="@+id/ongoing_notif_pgStatus"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/ongoing_notif_text"
        android:layout_toRightOf="@id/ongoing_notif_image"
        android:textAppearance = "@android:style/TextAppearance.StatusBar.EventContent" /> />
</RelativeLayout>

I have added the 'android:textApprearance' after following this suggestion stackoverflow item

Still no success though. Please note that this works fine on Android 4.0 upwards.

Это было полезно?

Решение

After spending many hours searching for it, I found the solution in another stackoverflow question and I though that I will post it here in case someone else comes across this question. The answer is here and is caused by a bug in the support library as shown here.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top