좋아, 나는 시행 착오 끝에 혼자 해결했다. 나는 나의 해결책을 여기에 게시 할 것을 생각했다.
한 위치를 나타내는 데 필요한보기가 들어있는 entity.xml이라는 xml.file을 만들었습니다. 또한 빈 linearLayout을 포함하는 widgetLayout.xml이라는 또 다른 XML 파일을 만듭니다.
그런 다음 동적으로 위젯 레이아웃을 만들려고 할 때 이렇게합니다.
RemoteViews main = new RemoteViews(getApplicationContext().getPackageName(), R.layout.widget_layout);
main.removeAllViews(R.id.main);
RemoteViews location = new RemoteViews(getApplicationContext().getPackageName(), R.layout.entity);
location.setTextViewText(R.id.SpotName, "loc");
RemoteViews location2 = new RemoteViews(getApplicationContext().getPackageName(), R.layout.entity);
spot1.setTextViewText(R.id.SpotName, "loc2");
main.addView(R.id.main, location);
main.addView(R.id.main, location2);
int[] allWidgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
AppWidgetManager.getInstance(getApplicationContext()).updateAppWidget(allWidgetIds[0], main);
수정 사항에 대한 축하합니다! 당신이 대답 할 수있을 때, 당신의 답이 같은 문제를 가진 다른 사람들이 접근 할 수 있도록 당신의 답을 '수락'으로 표시하도록하십시오. 건배 ~ –