プログラムで作成したレイアウトをリモートビューに追加しようとしています
ここに私の小さなデモがありますが、うまくいきませんでした:
LinearLayout parent = new LinearLayout(getAppContext());
parent.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
parent.setOrientation(LinearLayout.HORIZONTAL);
TextView tv1 = new TextView(getAppContext());
parent.addView(tv1);
parent.setId(0x7f03021b);
Remoteviews contentView = new RemoteViews(getAppContext().getPackageName(), parent.getId());
しかし、上記のコードは機能しません。