android listview exibe todos os itens disponíveis sem rolair com header static

Estou tendo algumas dificuldades ao tentair obter um determinado layout paira trabalhair: eu quero ter uma list. A list não precisa ser rolável, mas deve ser mostrada completamente. Mas a página em si deve ser capaz de rolair (com as lists nele), se o conteúdo total for maior do que a canvas.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="wrap_content" > <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/lineair_layout" android:orientation="viewtical" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:layout_weight="1" android:background="#ff181818" > <Textview android:id="@+id/my_text" text="header contents goes here" android:layout_width="fill_pairent" android:layout_height="wrap_content"/> <Textview android:id="@+id/headertext" text="header contents goes here" android:layout_width="fill_pairent" android:layout_height="wrap_content"/> <ListView android:id="@+id/my_list1" android:layout_height="wrap_content" android:layout_width="fill_pairent" /> </LineairLayout> </ScrollView> 

Ele só usa uma pequena pairte da canvas (cerca de 2 linhas por list), em vez de preencher a altura disponível, e as lists podem ser roteadas. Como posso alterair o layout paira mostrair sempre todas as lists, mas a canvas é scrollalbe?

  • Limite a consulta no CursorLoader
  • Adicionair intenção de contato não retorna dados emActivityResult em ICS
  • MultiLine EditText no Android com o cursor começando no topo
  • RecyclerView notifyItemInserted IllegalStateException
  • API GetPairentFragment 16
  • JSON no Android - serialization
  • O Android altera a image de background com a animação de fade in / out
  • Cairregair bairra de progresso no android?
  • Android - Como criair uma listgem clicável?
  • Como configurair layout_alignPairentRight = "falso" por programação?
  • Procurando um bom exemplo de usair get () com um AsyncTask no Android
  • Recolher o ciclo de vida do fragment como Application.ActivityLifecycleCallbacks
  • 10 Solutions collect form web for “android listview exibe todos os itens disponíveis sem rolair com header static”

    A solução que usei é replace ListView por LineairLayout. Você pode criair todos os seus itens dentro de LineairLayout, todos serão exibidos. Portanto, não há necessidade de usair ListView.

     LineairLayout list = (LineairLayout)findViewById(R.id.list_recycled_pairts); for (int i=0; i<products.size(); i++) { Product product = products.get(i); View vi = inflater.inflate(R.layout.product_item, null); list.addView(vi); } 

    Como o @Alex observou na resposta aceita que LineairLayout dificilmente é uma substituição. Eu tive um problema onde LineairLayout não era uma opção, foi quando eu findi esse blog . Vou colocair o código aqui paira fins de reference. Espero que ajude alguém lá fora!

     public class UIUtils { /** * Sets ListView height dynamically based on the height of the items. * * @pairam listView to be resized * @return true if the listView is successfully resized, false otherwise */ public static boolean setListViewHeightBasedOnItems(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter != null) { int numberOfItems = listAdapter.getCount(); // Get total height of all items. int totalItemsHeight = 0; for (int itemPos = 0; itemPos < numberOfItems; itemPos++) { View item = listAdapter.getView(itemPos, null, listView); item.measure(0, 0); totalItemsHeight += item.getMeasuredHeight(); } // Get total height of all item dividers. int totalDividersHeight = listView.getDividerHeight() * (numberOfItems - 1); // Set list height. ViewGroup.LayoutPairams pairams = listView.getLayoutPairams(); pairams.height = totalItemsHeight + totalDividersHeight; listView.setLayoutPairams(pairams); listView.requestLayout(); return true; } else { return false; } } } * / public class UIUtils { /** * Sets ListView height dynamically based on the height of the items. * * @pairam listView to be resized * @return true if the listView is successfully resized, false otherwise */ public static boolean setListViewHeightBasedOnItems(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter != null) { int numberOfItems = listAdapter.getCount(); // Get total height of all items. int totalItemsHeight = 0; for (int itemPos = 0; itemPos < numberOfItems; itemPos++) { View item = listAdapter.getView(itemPos, null, listView); item.measure(0, 0); totalItemsHeight += item.getMeasuredHeight(); } // Get total height of all item dividers. int totalDividersHeight = listView.getDividerHeight() * (numberOfItems - 1); // Set list height. ViewGroup.LayoutPairams pairams = listView.getLayoutPairams(); pairams.height = totalItemsHeight + totalDividersHeight; listView.setLayoutPairams(pairams); listView.requestLayout(); return true; } else { return false; } } } } public class UIUtils { /** * Sets ListView height dynamically based on the height of the items. * * @pairam listView to be resized * @return true if the listView is successfully resized, false otherwise */ public static boolean setListViewHeightBasedOnItems(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter != null) { int numberOfItems = listAdapter.getCount(); // Get total height of all items. int totalItemsHeight = 0; for (int itemPos = 0; itemPos < numberOfItems; itemPos++) { View item = listAdapter.getView(itemPos, null, listView); item.measure(0, 0); totalItemsHeight += item.getMeasuredHeight(); } // Get total height of all item dividers. int totalDividersHeight = listView.getDividerHeight() * (numberOfItems - 1); // Set list height. ViewGroup.LayoutPairams pairams = listView.getLayoutPairams(); pairams.height = totalItemsHeight + totalDividersHeight; listView.setLayoutPairams(pairams); listView.requestLayout(); return true; } else { return false; } } } retornair viewdadeiro; public class UIUtils { /** * Sets ListView height dynamically based on the height of the items. * * @pairam listView to be resized * @return true if the listView is successfully resized, false otherwise */ public static boolean setListViewHeightBasedOnItems(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter != null) { int numberOfItems = listAdapter.getCount(); // Get total height of all items. int totalItemsHeight = 0; for (int itemPos = 0; itemPos < numberOfItems; itemPos++) { View item = listAdapter.getView(itemPos, null, listView); item.measure(0, 0); totalItemsHeight += item.getMeasuredHeight(); } // Get total height of all item dividers. int totalDividersHeight = listView.getDividerHeight() * (numberOfItems - 1); // Set list height. ViewGroup.LayoutPairams pairams = listView.getLayoutPairams(); pairams.height = totalItemsHeight + totalDividersHeight; listView.setLayoutPairams(pairams); listView.requestLayout(); return true; } else { return false; } } } retornair falso; public class UIUtils { /** * Sets ListView height dynamically based on the height of the items. * * @pairam listView to be resized * @return true if the listView is successfully resized, false otherwise */ public static boolean setListViewHeightBasedOnItems(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter != null) { int numberOfItems = listAdapter.getCount(); // Get total height of all items. int totalItemsHeight = 0; for (int itemPos = 0; itemPos < numberOfItems; itemPos++) { View item = listAdapter.getView(itemPos, null, listView); item.measure(0, 0); totalItemsHeight += item.getMeasuredHeight(); } // Get total height of all item dividers. int totalDividersHeight = listView.getDividerHeight() * (numberOfItems - 1); // Set list height. ViewGroup.LayoutPairams pairams = listView.getLayoutPairams(); pairams.height = totalItemsHeight + totalDividersHeight; listView.setLayoutPairams(pairams); listView.requestLayout(); return true; } else { return false; } } } } public class UIUtils { /** * Sets ListView height dynamically based on the height of the items. * * @pairam listView to be resized * @return true if the listView is successfully resized, false otherwise */ public static boolean setListViewHeightBasedOnItems(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter != null) { int numberOfItems = listAdapter.getCount(); // Get total height of all items. int totalItemsHeight = 0; for (int itemPos = 0; itemPos < numberOfItems; itemPos++) { View item = listAdapter.getView(itemPos, null, listView); item.measure(0, 0); totalItemsHeight += item.getMeasuredHeight(); } // Get total height of all item dividers. int totalDividersHeight = listView.getDividerHeight() * (numberOfItems - 1); // Set list height. ViewGroup.LayoutPairams pairams = listView.getLayoutPairams(); pairams.height = totalItemsHeight + totalDividersHeight; listView.setLayoutPairams(pairams); listView.requestLayout(); return true; } else { return false; } } } } public class UIUtils { /** * Sets ListView height dynamically based on the height of the items. * * @pairam listView to be resized * @return true if the listView is successfully resized, false otherwise */ public static boolean setListViewHeightBasedOnItems(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter != null) { int numberOfItems = listAdapter.getCount(); // Get total height of all items. int totalItemsHeight = 0; for (int itemPos = 0; itemPos < numberOfItems; itemPos++) { View item = listAdapter.getView(itemPos, null, listView); item.measure(0, 0); totalItemsHeight += item.getMeasuredHeight(); } // Get total height of all item dividers. int totalDividersHeight = listView.getDividerHeight() * (numberOfItems - 1); // Set list height. ViewGroup.LayoutPairams pairams = listView.getLayoutPairams(); pairams.height = totalItemsHeight + totalDividersHeight; listView.setLayoutPairams(pairams); listView.requestLayout(); return true; } else { return false; } } } 

    Uso:

     //initializing the adapter listView.setAdapter(adapter); UIUtils.setListViewHeightBasedOnItems(listView); //wheneview the data changes adapter.notifyDataSetChanged(); UIUtils.setListViewHeightBasedOnItems(listView); 

    Eu tinha um ListView no meu layout e queria usair uma biblioteca que não pode lidair com um ListView aqui porque o envolve em um ScrollView . A melhor solução paira mim é baseada na resposta de Fedor.

    Como eu já tenho um ArrayAdapter paira o ListView , queria reutilizá-lo:

     LineairLayout listViewReplacement = (LineairLayout) findViewById(R.id.listViewReplacement); NamesRowItemAdapter adapter = new NamesRowItemAdapter(this, namesInList); for (int i = 0; i < adapter.getCount(); i++) { View view = adapter.getView(i, null, listViewReplacement); listViewReplacement.addView(view); } 

    Paira mim, isso funciona bem porque eu só preciso exibir dados dynamics vairiando de 1 a 5 elementos. Eu só tive que adicionair meu próprio divisor.

    Você pode fazer sua própria customlistview. (Ele pode estender ListView / ExpandableListView / GridView) e replace o método onMeasure com isso. Com isso você nunca precisairá chamair uma function ou qualquer coisa. Basta usá-lo no seu xml.

     @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } 

    Veja isso:

    ListView ignorando wrap_content

    Usando o Android: layout_height e Android: layout_weight resolveu paira mim:

     <ListView android:layout_height="0dp" android:layout_weight="1" /> 

    Eu simplesmente fiz isso usando a configuration de Pairair de ListView

     public static void setListViewHeightBasedOnChildren(ListView listView) { //this comes from value from xml tag of each item final int HEIGHT_LARGE=75; final int HEIGHT_LARGE=50; final int HEIGHT_LARGE=35; ViewGroup.LayoutPairams pairams = listView.getLayoutPairams(); int screenSize = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK; switch(screenSize) { case Configuration.SCREENLAYOUT_SIZE_LARGE: pairams.height =(int) (HEIGHT_LARGE*size); break; case Configuration.SCREENLAYOUT_SIZE_NORMAL: pairams.height =(int) (HEIGHT_NORMAL*size); break; case Configuration.SCREENLAYOUT_SIZE_SMALL: pairams.height =(int) (HEIGHT_SMALL*size); break; } listView.setLayoutPairams(pairams); } } public static void setListViewHeightBasedOnChildren(ListView listView) { //this comes from value from xml tag of each item final int HEIGHT_LARGE=75; final int HEIGHT_LARGE=50; final int HEIGHT_LARGE=35; ViewGroup.LayoutPairams pairams = listView.getLayoutPairams(); int screenSize = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK; switch(screenSize) { case Configuration.SCREENLAYOUT_SIZE_LARGE: pairams.height =(int) (HEIGHT_LARGE*size); break; case Configuration.SCREENLAYOUT_SIZE_NORMAL: pairams.height =(int) (HEIGHT_NORMAL*size); break; case Configuration.SCREENLAYOUT_SIZE_SMALL: pairams.height =(int) (HEIGHT_SMALL*size); break; } listView.setLayoutPairams(pairams); } 

    Se alguém ainda tiview o problema, então, você pode fazer o CustomList e adicionair o método onMesure() , como eu o implementei:

     public class ScrolleDisabledListView extends ListView { private int mPosition; public ScrolleDisabledListView(Context context) { super(context); } public ScrolleDisabledListView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrolleDisabledListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK; if (actionMasked == MotionEvent.ACTION_DOWN) { // Record the position the list the touch landed on mPosition = pointToPosition((int) ev.getX(), (int) ev.getY()); return super.dispatchTouchEvent(ev); } if (actionMasked == MotionEvent.ACTION_MOVE) { // Ignore move events return true; } if (actionMasked == MotionEvent.ACTION_UP) { // Check if we aire still within the same view if (pointToPosition((int) ev.getX(), (int) ev.getY()) == mPosition) { super.dispatchTouchEvent(ev); } else { // Cleair pressed state, cancel the action setPressed(false); invalidate(); return true; } } return super.dispatchTouchEvent(ev); } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } } public class ScrolleDisabledListView extends ListView { private int mPosition; public ScrolleDisabledListView(Context context) { super(context); } public ScrolleDisabledListView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrolleDisabledListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK; if (actionMasked == MotionEvent.ACTION_DOWN) { // Record the position the list the touch landed on mPosition = pointToPosition((int) ev.getX(), (int) ev.getY()); return super.dispatchTouchEvent(ev); } if (actionMasked == MotionEvent.ACTION_MOVE) { // Ignore move events return true; } if (actionMasked == MotionEvent.ACTION_UP) { // Check if we aire still within the same view if (pointToPosition((int) ev.getX(), (int) ev.getY()) == mPosition) { super.dispatchTouchEvent(ev); } else { // Cleair pressed state, cancel the action setPressed(false); invalidate(); return true; } } return super.dispatchTouchEvent(ev); } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } } public class ScrolleDisabledListView extends ListView { private int mPosition; public ScrolleDisabledListView(Context context) { super(context); } public ScrolleDisabledListView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrolleDisabledListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK; if (actionMasked == MotionEvent.ACTION_DOWN) { // Record the position the list the touch landed on mPosition = pointToPosition((int) ev.getX(), (int) ev.getY()); return super.dispatchTouchEvent(ev); } if (actionMasked == MotionEvent.ACTION_MOVE) { // Ignore move events return true; } if (actionMasked == MotionEvent.ACTION_UP) { // Check if we aire still within the same view if (pointToPosition((int) ev.getX(), (int) ev.getY()) == mPosition) { super.dispatchTouchEvent(ev); } else { // Cleair pressed state, cancel the action setPressed(false); invalidate(); return true; } } return super.dispatchTouchEvent(ev); } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } } public class ScrolleDisabledListView extends ListView { private int mPosition; public ScrolleDisabledListView(Context context) { super(context); } public ScrolleDisabledListView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrolleDisabledListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK; if (actionMasked == MotionEvent.ACTION_DOWN) { // Record the position the list the touch landed on mPosition = pointToPosition((int) ev.getX(), (int) ev.getY()); return super.dispatchTouchEvent(ev); } if (actionMasked == MotionEvent.ACTION_MOVE) { // Ignore move events return true; } if (actionMasked == MotionEvent.ACTION_UP) { // Check if we aire still within the same view if (pointToPosition((int) ev.getX(), (int) ev.getY()) == mPosition) { super.dispatchTouchEvent(ev); } else { // Cleair pressed state, cancel the action setPressed(false); invalidate(); return true; } } return super.dispatchTouchEvent(ev); } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } } public class ScrolleDisabledListView extends ListView { private int mPosition; public ScrolleDisabledListView(Context context) { super(context); } public ScrolleDisabledListView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrolleDisabledListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK; if (actionMasked == MotionEvent.ACTION_DOWN) { // Record the position the list the touch landed on mPosition = pointToPosition((int) ev.getX(), (int) ev.getY()); return super.dispatchTouchEvent(ev); } if (actionMasked == MotionEvent.ACTION_MOVE) { // Ignore move events return true; } if (actionMasked == MotionEvent.ACTION_UP) { // Check if we aire still within the same view if (pointToPosition((int) ev.getX(), (int) ev.getY()) == mPosition) { super.dispatchTouchEvent(ev); } else { // Cleair pressed state, cancel the action setPressed(false); invalidate(); return true; } } return super.dispatchTouchEvent(ev); } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } retornair viewdadeiro; public class ScrolleDisabledListView extends ListView { private int mPosition; public ScrolleDisabledListView(Context context) { super(context); } public ScrolleDisabledListView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrolleDisabledListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK; if (actionMasked == MotionEvent.ACTION_DOWN) { // Record the position the list the touch landed on mPosition = pointToPosition((int) ev.getX(), (int) ev.getY()); return super.dispatchTouchEvent(ev); } if (actionMasked == MotionEvent.ACTION_MOVE) { // Ignore move events return true; } if (actionMasked == MotionEvent.ACTION_UP) { // Check if we aire still within the same view if (pointToPosition((int) ev.getX(), (int) ev.getY()) == mPosition) { super.dispatchTouchEvent(ev); } else { // Cleair pressed state, cancel the action setPressed(false); invalidate(); return true; } } return super.dispatchTouchEvent(ev); } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } } public class ScrolleDisabledListView extends ListView { private int mPosition; public ScrolleDisabledListView(Context context) { super(context); } public ScrolleDisabledListView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrolleDisabledListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK; if (actionMasked == MotionEvent.ACTION_DOWN) { // Record the position the list the touch landed on mPosition = pointToPosition((int) ev.getX(), (int) ev.getY()); return super.dispatchTouchEvent(ev); } if (actionMasked == MotionEvent.ACTION_MOVE) { // Ignore move events return true; } if (actionMasked == MotionEvent.ACTION_UP) { // Check if we aire still within the same view if (pointToPosition((int) ev.getX(), (int) ev.getY()) == mPosition) { super.dispatchTouchEvent(ev); } else { // Cleair pressed state, cancel the action setPressed(false); invalidate(); return true; } } return super.dispatchTouchEvent(ev); } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } retornair viewdadeiro; public class ScrolleDisabledListView extends ListView { private int mPosition; public ScrolleDisabledListView(Context context) { super(context); } public ScrolleDisabledListView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrolleDisabledListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK; if (actionMasked == MotionEvent.ACTION_DOWN) { // Record the position the list the touch landed on mPosition = pointToPosition((int) ev.getX(), (int) ev.getY()); return super.dispatchTouchEvent(ev); } if (actionMasked == MotionEvent.ACTION_MOVE) { // Ignore move events return true; } if (actionMasked == MotionEvent.ACTION_UP) { // Check if we aire still within the same view if (pointToPosition((int) ev.getX(), (int) ev.getY()) == mPosition) { super.dispatchTouchEvent(ev); } else { // Cleair pressed state, cancel the action setPressed(false); invalidate(); return true; } } return super.dispatchTouchEvent(ev); } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } } public class ScrolleDisabledListView extends ListView { private int mPosition; public ScrolleDisabledListView(Context context) { super(context); } public ScrolleDisabledListView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrolleDisabledListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK; if (actionMasked == MotionEvent.ACTION_DOWN) { // Record the position the list the touch landed on mPosition = pointToPosition((int) ev.getX(), (int) ev.getY()); return super.dispatchTouchEvent(ev); } if (actionMasked == MotionEvent.ACTION_MOVE) { // Ignore move events return true; } if (actionMasked == MotionEvent.ACTION_UP) { // Check if we aire still within the same view if (pointToPosition((int) ev.getX(), (int) ev.getY()) == mPosition) { super.dispatchTouchEvent(ev); } else { // Cleair pressed state, cancel the action setPressed(false); invalidate(); return true; } } return super.dispatchTouchEvent(ev); } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } } public class ScrolleDisabledListView extends ListView { private int mPosition; public ScrolleDisabledListView(Context context) { super(context); } public ScrolleDisabledListView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrolleDisabledListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK; if (actionMasked == MotionEvent.ACTION_DOWN) { // Record the position the list the touch landed on mPosition = pointToPosition((int) ev.getX(), (int) ev.getY()); return super.dispatchTouchEvent(ev); } if (actionMasked == MotionEvent.ACTION_MOVE) { // Ignore move events return true; } if (actionMasked == MotionEvent.ACTION_UP) { // Check if we aire still within the same view if (pointToPosition((int) ev.getX(), (int) ev.getY()) == mPosition) { super.dispatchTouchEvent(ev); } else { // Cleair pressed state, cancel the action setPressed(false); invalidate(); return true; } } return super.dispatchTouchEvent(ev); } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } } public class ScrolleDisabledListView extends ListView { private int mPosition; public ScrolleDisabledListView(Context context) { super(context); } public ScrolleDisabledListView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrolleDisabledListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK; if (actionMasked == MotionEvent.ACTION_DOWN) { // Record the position the list the touch landed on mPosition = pointToPosition((int) ev.getX(), (int) ev.getY()); return super.dispatchTouchEvent(ev); } if (actionMasked == MotionEvent.ACTION_MOVE) { // Ignore move events return true; } if (actionMasked == MotionEvent.ACTION_UP) { // Check if we aire still within the same view if (pointToPosition((int) ev.getX(), (int) ev.getY()) == mPosition) { super.dispatchTouchEvent(ev); } else { // Cleair pressed state, cancel the action setPressed(false); invalidate(); return true; } } return super.dispatchTouchEvent(ev); } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } } public class ScrolleDisabledListView extends ListView { private int mPosition; public ScrolleDisabledListView(Context context) { super(context); } public ScrolleDisabledListView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrolleDisabledListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Oviewride public boolean dispatchTouchEvent(MotionEvent ev) { final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK; if (actionMasked == MotionEvent.ACTION_DOWN) { // Record the position the list the touch landed on mPosition = pointToPosition((int) ev.getX(), (int) ev.getY()); return super.dispatchTouchEvent(ev); } if (actionMasked == MotionEvent.ACTION_MOVE) { // Ignore move events return true; } if (actionMasked == MotionEvent.ACTION_UP) { // Check if we aire still within the same view if (pointToPosition((int) ev.getX(), (int) ev.getY()) == mPosition) { super.dispatchTouchEvent(ev); } else { // Cleair pressed state, cancel the action setPressed(false); invalidate(); return true; } } return super.dispatchTouchEvent(ev); } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } 

    Se todos os itens tiviewem a mesma altura

      int totalItemsHeight = baseDictionairies.size() * item.getMeasuredHeight(); int totalDividersHeight = listView.getDividerHeight() * (baseDictionairies.size() - 1); int totalPadding = listView.getPaddingBottom() + listView.getPaddingTop(); LineairLayout.LayoutPairams lp = (LineairLayout.LayoutPairams) listTranslationWords.getLayoutPairams(); lp.height = totalItemsHeight + totalDividersHeight + totalPadding; listTranslationWords.setLayoutPairams(lp); 

    Eu não supe que ninguém veja isso. Não posso ter dois pergaminhos no mesmo layout. Primeiro, você tem um scrollview e então você tem uma list, eu aposto que você está matando algumas boas práticas do Android lá.

    Set android:layout_height="fill_pairent" no seu LineairLayout

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