From API level 11 setDividerDrawable(), it setShowDividers()was introduced on LinearLayout, allowing the line layout to show separators between children. I would really like to use this function, but I also configure devices to Honeycomb (API level and lt; 11).
One way to fix this is to extend LinearLayout and add a separator manually. This is a prototype:
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
public class DividerLinearLayout extends LinearLayout
{
public DividerLinearLayout(Context context)
{
super(context);
}
public DividerLinearLayout(Context context, AttributeSet attrs)
{
super(context, attrs);
}
public DividerLinearLayout(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
}
@Override
public void addView(View child)
{
if(super.getChildCount() > 0)
{
super.addView(LayoutInflater.from(getContext()).inflate(R.layout.divider, null));
}
super.addView(child);
}
}
, . , , DividerLinearLayout. , . , , . , , .
? - DividerLinearLayout? , , Android.