As far as I understand, android widgets need RemoteViews, instead of View, like activities.
My question: is there any way to completely avoid xml, and build the whole layout with java code?
Alternative question: can I somehow retrieve a View, like I would use findViewById(int)
? For example: LinearLayout linearLayout=(LinearLayout)findViewById(R.id.xxx);
This way I could access the base layout, and manipulate however I want to.
Thanks!
is there any way to completely avoid xml, and build the whole layout with java code?
No, sorry. RemoteViews
relies heavily on layout XML resources. While there is an addView()
method, it turns around and adds another RemoteViews
, and that puts you right back where you started from.
can I somehow retrieve a View, like I would use findViewById(int)?
No, because there is no View
in your process. You configure the widgets via the various setter methods on RemoteViews
.