I think RemoteView has no weight property.
I'm not sure this will work, but give it a try.
RemoteViews remoteViews = new RemoteViews("", 0);
LinearLayout.LayoutParams tempLayoutParams =new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
tempLayoutParams.weight = 1.0f;
LinearLayout tempLinearLayout = new LinearLayout(getContext()):
tempLinearLayout.setLayoutParams(tempLayoutParams);
tempLinearLayout.addView(remoteViews);
Good luck.
source
share