customView如何可以扩展constraintLayout但会增大线性布局

时间:2018-11-15 09:41:41

标签: android android-layout layout layout-inflater

说我有一个自定义的android视图:

public class myView extends ConstraintLayout {

在其ctor中,我称:

LayoutInflater.from(context).inflate(R.layout.header, this, true);

我看到inflate返回了View,但是调用代码根本没有使用它。那么如何影响呢?

此外,如果customView继承自constraintLayout但膨胀的xml是线性布局,会发生什么情况

为什么会起作用?

0 个答案:

没有答案