【发布时间】:2013-11-09 19:16:34
【问题描述】:
我正在尝试以编程方式构建自己的布局,然后“构建”RemoteViews 并将其显示为通知。
骨架:
LinearLayout baseLayout = new LinearLayout(context);
for (X) {
LinearLayout innerLayout = new LinearLayout(context);
for (Y) {
TextView textV = new TextView(context);
}
innerLayout.addView(textV);
}
baseLayout.addView(innerLayout);
}
RemoteViews remoteView = new RemoteViews(getPcakageName(), baseLayout.getId());
对于每个布局,我通过此处介绍的方法设置LayoutParams、orientation 和ID:https://stackoverflow.com/a/15442898/1405268。
当我尝试使用 RemoteViews 启动通知时,我收到“从包 XXX 发布的错误通知:无法为 StatusBarNotification 展开 RemoteViews...
谢谢
【问题讨论】:
标签: android android-layout notifications android-linearlayout remoteview