xmlではなくjavaを使用してカスタムステータスバー通知レイアウトを作成しようとしています。リニアレイアウトを作成し、必要なパラメーターを設定し、通知リモートビューで設定しましたが、FCが提供されます。(「悪い通知が投稿されました」)
これが私のテストコードです:
LinearLayout layoutTest;
layoutTest = new LinearLayout(this);
layoutTest.setOrientation(LinearLayout.VERTICAL);
LayoutParams paramTest = new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT, 1.0f);
layoutTest.setLayoutParams(paramTest);
layoutTest.setId(R.id.mlinearlayout);
contentView = new RemoteViews(this.getPackageName(), R.id.mlinearlayout);
nbuilder.setContent(contentView);
// and all the other notification builder good stuff
私はsetId()にあまり詳しくありませんが、それが問題になる可能性がありますか?IDの場合、次のコマンドで/res/values/ids.xmlを作成しました。
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="mlinearlayout" />
</resources>
どんな助けでも大歓迎です!