MrSnowflake wrote:Of course you can. You can even use your own layout in xml. Extend ViewGroup and you are going... You could use the source of ie LinearLayout for reference.

Sadly, it seems that there are significant layout properties that can only be accessed by inflating from XML (e.g., "layout_gravity"). Quite annoying for those of us who like to instantiate and extend objects in Java.

Of course from com.android.p2 you have access to R.java with com.android.p1.R. But keep in mind this will only work between 2 packages in the same apk. And as a reminder: Don't use com.android for your own applications (but you probably knew this already).