在我的应用程序中,我无法在通知中看到我显示的所有文本。我输入了 \n 但这对我没有帮助,我不明白为什么。
这是proba.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:padding="3dp">
<ImageView android:id="@+id/image" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_marginRight="10dp" />
<TextView android:id="@+id/notif" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:textColor="#000" />
</LinearLayout>
这是代码:
RemoteViews contentView = new RemoteViews(getPackageName(),
R.layout.proba);
contentView.setImageViewResource(R.id.image, R.drawable.icon);
contentView.setTextViewText(R.id.notif,
"Today,you must go for shopping for your list '" + list + "'. "
+ "Don't forget!!!" + "\n" + "You must buy :" + "\n"
+ s.toString() + "\n");
notification.contentView = contentView;
其中 s 中是一个 StringBuilder,在 s 中我有这样的内容:“洋葱 1 公斤,西红柿 2 公斤,...”
stringBuilder 不是字符串。使用s.toString()
实际得到一个字符串。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)