appwidget 에서 xml 을 통해 UI를 생성하는게 아니라
소스상 layout을 구현하려고 하는데요.
하기와 같이 구현했는데 적용이안되네요.^^;
혹시 다른방법으로 구현을 해야하는지요?
LinearLayout dynamicLayout;
dynamicLayout = (LinearLayout)menu.findViewById(R.id.dynLayout);
dynamicLayout.removeAllViews();
LinearLayout lLayout = new LinearLayout(context);
lLayout.setId((9000));
lLayout.setPadding(10, 0, 0, 0);
lLayout.setOrientation(LinearLayout.HORIZONTAL);
lLayout.setBackgroundColor(Color.BLUE);
lLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
dynamicLayout.addView(lLayout);
int widgetId = appWidgetIds[i];
Intent intent = new Intent( context, M.class );
PendingIntent pendingIntent = PendingIntent.getActivity( context, 0, intent, 0 );
RemoteViews remoteView = new RemoteViews( context.getPackageName(), R.layout.widget_layout );
appWidgetManager.updateAppWidget( widgetId, remoteView );
RemoteView의 경우 지정 된 RayoutID를 이용해서, LayoutInflater에서 해당 View를 생성하고,
RemoteView에 설정된 값으로 View를 다시 구성하는 방식으로 되어 있어서, 업데이트가 되지 않을 꺼에요.
어떤 형식으로 화면에 보여주려고 하는 건지는 모르겠지만,
remoteView API를 이용해서 값을 설정해야 해요.