Tecnologia do Blogger.
RSS

[androidbrasil-dev] LinearLayout -> addView e Merge

Pessoal, tenho um linear layout e um XML separado que tem 2 botões envolta de um <merge/>, quando eu inflo essa view e dou addView no linearlayout com ela sempre tenho um erro:


addView(LayoutInflater.from(this).inflate(R.layout.coisa, null))
>>> Caused by: android.view.InflateException: <merge /> can be used only with a valid ViewGroup root and attachToRoot=true

Ou com o true pro attach root.

addView(LayoutInflater.from(this).inflate(R.layout.coisa, null, true))
>>> Caused by: android.view.InflateException: <merge /> can be used only with a valid ViewGroup root and attachToRoot=true

O engraçado é que via XML com include funciona OK (o include como filho do LinearLayout).

O que estou fazendo errado?

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário