Android TextView没有';不要显示所有的文本
在我的应用程序中,我无法在通知中看到我显示的所有文本。我放了\n但这对我没有帮助,我不明白为什么 这是proba.xmlAndroid TextView没有';不要显示所有的文本,android,notifications,Android,Notifications,在我的应用程序中,我无法在通知中看到我显示的所有文本。我放了\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" a
<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>
在s中是一个字符串生成器,在s中我有这样的东西:“洋葱1公斤,西红柿2公斤,…”字符串生成器不是字符串。使用
s.toString()
实际获取字符串 默认情况下,TextView
s是单行()。您可以通过将android:singleLine=“false”
添加到您的proba.xml
I put s.toString(),使它们成为多行的,但这不会因为我的通知而改变。我只看到了课文的一部分。你看到了哪一部分?如果只在textview中添加几个字符串,为什么还要使用stringbuilder呢。stringbuilder的整个理念就是你不必这么做。我明白了:“今天,你必须去购物,买你的清单。别忘了!!!你必须买1公斤洋葱。”。我把购物清单上的物品放在s里。我使用StringBuilder将所有项放在一个变量中。所以,在s中,我有更多的项目,但我只看到第一个项目和第二个项目的一部分。您的视图是否足够大,可以容纳所有文本?如果输出字符串trought日志会发生什么?发布屏幕截图。绳子在哪里剪?显示字符串的哪个部分,缺少什么?请详细说明您的问题,我的玻璃碗目前没有。:)不知道我为什么会有这个问题(
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;