本文介绍了Android的无法展开...... remoteViews“创建布局时,编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立自己的布局编程然后'建设 RemoteViews 并显示为通知。

骨架:

 的LinearLayout的baselayout =新的LinearLayout(背景);
为(X){
    的LinearLayout innerLayout =新的LinearLayout(背景);
        对于(Y){
            TextView的textV =新的TextView(背景);
        }
        innerLayout.addView(textV);
    }
    baseLayout.addView(innerLayout);
}
RemoteViews远程视窗=新RemoteViews(getPcakageName(),baseLayout.getId());

为每个布局我设置的LayoutParams 定位 ID 从方法presented这里:http://stackoverflow.com/a/15442898/1405268.

当我尝试启动该通知的 RemoteViews ,我得到`从包XXX贴坏通知:无法扩大StatusBarNotification RemoteViews ...

感谢


解决方案

The ID passed to the RemoteViews constructor needs to be a layout resource ID. You then need to use methods on RemoteViews to attempt to build your structure, though I am dubious that it will work.

这篇关于Android的无法展开...... remoteViews“创建布局时,编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 12:08