TextInputLayout not showing when View added programmatically

前端 未结 2 866
傲寒
傲寒 2021-01-04 07:59

I noticed some strange behaviour of TextInputLayout:

When I add the following to my layout:

    

        
2条回答
  •  清酒与你
    2021-01-04 08:48

    I use this ((FrameLayout) findViewById(R.id.framePreview)).addView(preview); with no issues at all, maybe its the view type? should this

    ViewGroup root = (ViewGroup) findViewById(R.id.root);
    root.addView(v);
    

    not be this

    LinearLayout root = (LinearLayout) findViewById(R.id.root);
    root.addView(v);
    

提交回复
热议问题