Pages

Simple Custom Control Template

Class
 
public class Xxxxxx extends LinearLayout {
   public Xxxxxx(Context context, AttributeSet attrs) {
      super(context, attrs);
      LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      inflater.inflate(R.layout.zzzzzzz, this);
   }
}
 
Layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="
http://schemas.android.com/apk/res/android"
   android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content">
   <!-- Put your controls here -->
</LinearLayout>
 
Consumer
 
<packagename.Xxxxxx android:id="@+id/Xxxxxx01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>