Skip to content Skip to sidebar Skip to footer

Custom Layout In Android

Does anyone know how to implement custom layouts in android? I have CustomLayout class. CustomLayout extends LinearLayout with constructors public CustomLayout(Context context) an

Solution 1:

I found that you must override this method.

publicvoidaddView(View child, android.view.ViewGroup.LayoutParams params)
{
    //... 
    llContainer.addView(child, fillParentLayoutParams);
    //...
}

where llContainer is the layout where the views should be placed. this method is called by the inflater to populate your view with the xml definitions.

Post a Comment for "Custom Layout In Android"