是否可以将我的customView传递到Android中的setContentView?

时间:2017-12-14 00:11:46

标签: android layout-inflater android-viewgroup

在我的onCreate中我有一个我想动态设置的布局

 LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View coachLayout = inflater.inflate(R.layout.coach_content, null);
    LinearLayout coachLinear = (LinearLayout) coachLayout.findViewById(R.id.coachLinear);
    TextView titleView = (TextView) coachLayout.findViewById(R.id.coachTitle);
    updateTitleView(activity, widget, titleView);

我希望将我的View coachlayout传递到setContentView(R.layout.activity_main)

但是setContentView只接受Resource id或int。那么无论如何将我的coachlayout传递给setContentView?

谢谢

0 个答案:

没有答案