如何再次膨胀到膨胀的布局?

时间:2012-07-09 08:12:11

标签: android

例如

layoutC (headerView)[add->] layoutB (listView)[add->] layoutA (活动)

所以 layoutA 将包含 layoutB layoutC ,但 layoutC 将是 layoutB <的标题视图/ strong>即可。我想要以这种方式创建的原因是因为layoutB可能共享6页但layoutC会有不同的类型。

我创建了一个类调用layoutB

public class layoutB extends RelativeLayout implements CustomListener{

Context mContext;

public layoutB(Context context) {
     super(context);
}


public Archived(Context context, AttributeSet attrs) {
    super(context, attrs);
    LayoutInflater.from(context).inflate(R.layout.layout_b, this);
}

public Archived(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    LayoutInflater.from(context).inflate(R.layout.layout_b, this);
}


public void inflateLayoutC(int top_layout) {
    ListView listView1= (ListView) findViewById(R.id.listView1);
    LayoutInflater inflater = LayoutInflater.from(getContext());
    View Top = inflater.inflate(R.layout.layout_c, null);
    listView1.addHeaderView(Top);
}

inflateLayoutC,我应该如何将layoutC添加到布局B

0 个答案:

没有答案