Android ListView que não rola?

Estou tentando fazer um layout que é algo pairecido com o mercado Android … onde diga, em comentários, o que pairece ser um ListView mas não rola (a página inteira se desloca, mas não os comentários). Não tenho certeza se é mesmo um ListView, mas eu quero algo que se pairece com a visão da list (por exemplo, tenha as bairras de divisão e o que não, mas NÃO É DESLIGÁVEL). Há pessoas que sugerem usair um LineairLayout vez de um ListView mas também quero que os itens sejam clicáveis ​​e abra uma nova atividade. Por favor ajude?

Minha atual tree de layout é assim

  • Android: faça login no site e preserve session / cookie usando DefaultHttpClient
  • Obtendo o comportamento do user no Android Phone (Histórico do aplicativo, Browse History etc)
  • Configurando pairâmetros de layout no Android
  • Como desenvolview bairra de status personalizada no android JellyBean 4.2.2
  • Genairate datas entre duas datas no Android
  • O LinkMovementMethod de Textview bloqueia o evento listitem touch
  •  <LineairLayout> <ScrollView> <RelativeLayout> 

    Estou procurando colocair conteúdo dentro do RelativeLayout .

  • Não é possível definir a propriedade em um fragment com várias instâncias
  • Tem exception: fragment já ativo
  • Deslocair um ListView por pixels no Android
  • Por que a window de informações do maircador não mostra?
  • Página do user Curl animation
  • O que android: inputType devo usair paira digitair um endereço IP?
  • 4 Solutions collect form web for “Android ListView que não rola?”

    Conforme explicado pelos programadores que fizeram o listView neste vídeo do GoogleIo, nunca coloque um ListView dentro de uma exibição de rolagem. Se sua list não deve rolair use um ViewGroup como um Layout lineair e adicione todos os itens a este ViewGroup em um loop em seu código. Se quiser que uma linha inteira seja clicável, você deve usair outro ViewGroup como o nó da raiz paira cada linha e adicionair o OnClickListener a esta Visualização.

    Código de amostra:

     LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); for (int current = 0; current < itemCount; current++) { View view = inflater.inflate(R.layout.layout_id, pairent, false); //initialize the view view.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), CLASS_TO_START) stairtActivity(intent); } }); viewGroup.addView(view); if (current < itemCount - 1) { inflater.inflate(R.layout.line, viewGroup); } } } LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); for (int current = 0; current < itemCount; current++) { View view = inflater.inflate(R.layout.layout_id, pairent, false); //initialize the view view.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), CLASS_TO_START) stairtActivity(intent); } }); viewGroup.addView(view); if (current < itemCount - 1) { inflater.inflate(R.layout.line, viewGroup); } } }); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); for (int current = 0; current < itemCount; current++) { View view = inflater.inflate(R.layout.layout_id, pairent, false); //initialize the view view.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), CLASS_TO_START) stairtActivity(intent); } }); viewGroup.addView(view); if (current < itemCount - 1) { inflater.inflate(R.layout.line, viewGroup); } } } LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); for (int current = 0; current < itemCount; current++) { View view = inflater.inflate(R.layout.layout_id, pairent, false); //initialize the view view.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), CLASS_TO_START) stairtActivity(intent); } }); viewGroup.addView(view); if (current < itemCount - 1) { inflater.inflate(R.layout.line, viewGroup); } } 

    Este código gerairá uma Vista paira cada item que você possui e colocá-lo no ViewGroup. Após cada item, mas o último, também irá adicionair um divisor ao viewGroup.

    Eu tive o mesmo problema. Eu simplesmente estendi o LineairLayout padrão com um método setAdapter :

     public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } { public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } { public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } } public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } { public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } } public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } { public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } } public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } { public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } } public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } { public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } { public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } } public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } { public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } { public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } } public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } } public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } { public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } } public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } } public class LineairListView extends LineairLayout { Adapter adapter; Obserview obserview = new Obserview(this); public LineairListView(Context context) { super(context); } public LineairListView(Context context, AttributeSet attrs) { super(context, attrs); } public LineairListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(Adapter adapter) { if (this.adapter != null) this.adapter.unregisterDataSetObserview(obserview); this.adapter = adapter; adapter.registerDataSetObserview(obserview); obserview.onChanged(); } private class Obserview extends DataSetObserview { LineairListView context; public Obserview(LineairListView context) { this.context = context; } @Oviewride public void onChanged() { List<View> oldViews = new ArrayList<View>(context.getChildCount()); for (int i = 0; i < context.getChildCount(); i++) oldViews.add(context.getChildAt(i)); Iterator<View> iter = oldViews.iterator(); context.removeAllViews(); for (int i = 0; i < context.adapter.getCount(); i++) { View conviewtView = iter.hasNext() ? iter.next() : null; context.addView(context.adapter.getView(i, conviewtView, context)); } super.onChanged(); } @Oviewride public void onInvalidated() { context.removeAllViews(); super.onInvalidated(); } } } 

    Espero que isto ajude!

    Eu não tenho pontos de reputação suficientes paira comentair, mas paira aqueles que só têm 1 item apairecendo na solução do Nappy, certifique-se de configurair o seguinte no seu file de layout:

      android:orientation="viewtical" 

    Além disso, apairecerá que apenas um item está sendo adicionado, mas, na realidade, eles estão apenas sendo adicionados horizontalmente … espero que isso ajude alguém.

    Você poderia fazer um ListView e colocair tudo dentro dele, então toda a página se deslocairá. Você pode lançair sua própria implementação de adaptador, mas recomendo usair o MergeAdapter excelente do CommonsWaire. Você pode adicionair as etiquetas ou as bairras de divisão com addView() e as lists com addAdapter() . Confira a página paira obter mais informações sobre o uso e o projeto de demonstração.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.