Update: I created a repository with less code to make it a bit easier to understand.
I\'m trying to create a widget. I made it like describ
I found the answer myself.
To fix the problem with the weird adding of views on scrolling and resizing you have to call removeAllViews
on the Layout where the subviews were added:
@Override
public RemoteViews getViewAt(int position) {
...
RemoteViews itemView = new RemoteViews(context.getPackageName(), R.layout.widget_listview_item);
itemView.removeAllViews(R.id.linearLayout_item_body);
...
return itemView;
}
And the problem that the views are not displayed is because of the color: After adding
subitem.setTextColor(R.id.textView_1, context.getResources().getColor(R.color.abc_primary_text_material_light));
subitem.setTextColor(R.id.textView_2, context.getResources().getColor(R.color.abc_primary_text_material_light));
subitem.setTextColor(R.id.textView_3, context.getResources().getColor(R.color.abc_primary_text_material_light));
all views are displayed: