Última linha de list extensível não vista completa no android

Red mark Row view

Aqui eu uso a visualização e o código conforme indicado abaixo.

  • Como fornecer animações personalizadas durante a triagem (notifyDataSetChanged) no RecyclerView
  • Considerações do Android GC - quando o GC é executado e seu estado de execução pode ser rastreado a pairtir do código?
  • Android, javamail e proguaird
  • onGlobalLayout diferencia entre várias invocações
  • Como adicionair uma opção à bairra de ação do Android?
  • Escreva um file no airmazenamento externo no Android
  • <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical"> <TableRow android:id="@+id/tab_stone_info" android:layout_width="match_pairent" android:layout_height="30dp" android:layout_mairginTop="1dp" android:background="@color/styleBreakTabColor" android:weightSum="9"> <TextView android:id="@+id/stone_Type" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:background="@drawable/cell_shape" android:gravity="center" android:text="@string/Type" android:textColor="@color/txtStyleBreakup" android:textSize="12sp" /> <TextView android:id="@+id/stone_Shape" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:background="@drawable/cell_shape" android:gravity="center" android:text="@string/Shape" android:textColor="@color/txtStyleBreakup" android:textSize="12sp" /> <TextView android:id="@+id/stone_Qlty" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:background="@drawable/cell_shape" android:gravity="center" android:text="@string/Quality" android:textColor="@color/txtStyleBreakup" android:textSize="12sp" /> <TextView android:id="@+id/stone_Grade" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:background="@drawable/cell_shape" android:gravity="center" android:text="@string/Grade" android:textColor="@color/txtStyleBreakup" android:textSize="12sp" /> <TextView android:id="@+id/stone_Qty" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:background="@drawable/cell_shape" android:gravity="center" android:text="@string/Qty" android:textColor="@color/txtStyleBreakup" android:textSize="12sp" /> <TextView android:id="@+id/stone_Wt" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:background="@drawable/cell_shape" android:gravity="center" android:text="@string/Wt" android:textColor="@color/txtStyleBreakup" android:textSize="12sp" /> <TextView android:id="@+id/stone_MMSize" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:background="@drawable/cell_shape" android:gravity="center" android:text="@string/MMSize" android:textColor="@color/txtStyleBreakup" android:textSize="12sp" /> <TextView android:id="@+id/stone_Setting" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:background="@drawable/cell_shape" android:gravity="center" android:text="@string/Setting" android:textColor="@color/txtStyleBreakup" android:textSize="12sp" /> <TextView android:id="@+id/stone_SettMode" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:background="@drawable/cell_shape" android:gravity="center" android:text="@string/SettingMode" android:textColor="@color/txtStyleBreakup" android:textSize="12sp" /> </TableRow> <RelativeLayout android:id="@+id/layout_tab_stone_info_value" android:layout_width="match_pairent" android:layout_height="match_pairent" > <com.mindtech.ExpandableHeightListView android:id="@+id/listviewstone" android:layout_width="match_pairent" android:layout_height="wrap_content" android:divider="#00000000" android:gravity="center" android:horizontalSpacing="2dp" android:isScrollContainer="false" android:stretchMode="columnWidth" android:viewticalSpacing="20dp" /> </RelativeLayout> </LineairLayout> 

    E eu uso epandablelistview como abaixo da class.

     public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } { public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } { public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } } public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } { public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } } public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } { public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } } public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } { public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } } public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } { public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } { public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } } public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } { public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } } public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } } public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } { public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } } public class ExpandableHeightListView extends ListView { boolean expanded = false; public ExpandableHeightListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ExpandableHeightListView(Context context) { super(context); } public ExpandableHeightListView(Context context, AttributeSet attrs) { super(context, attrs); } public boolean isExpanded() { return expanded; } @Oviewride public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, // MeasureSpec.AT_MOST); // // super.onMeasure(widthMeasureSpec, expandSpec); // int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( // Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); // super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); // ViewGroup.LayoutPairams pairams = getLayoutPairams(); // pairams.height = getMeasuredHeight(); if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } public void setExpanded(boolean expanded) { this.expanded = expanded; } } 

    Eu encaminhei essa questão, mas não fiquei correta. Grade de imagens dentro ScrollView

    A altura do Gridview é cortada

    O problema principal ocorre quando a altura da primeira queue não é maior do que a segunda ou outra. se todo o comprimento do conteúdo da linha for igual, então não há problemas.

  • Dados que passam paira outro aplicativo no Android
  • Google Maps Android API V2 não mostra mapas no Emulador
  • java.lang.NoClassDefFoundError: resolução crashda de: Landroid / support / v4 / os / BuildCompat
  • Como fazer o AdView "ocupair" o espaço mesmo ao solicitair um anúncio? (Android)
  • Qual o tamanho do token do dispositivo iOS e Androids
  • AccountManager getUserData retornando nulo apesair de ser configurado
  • 3 Solutions collect form web for “Última linha de list extensível não vista completa no android”

    Pairece que você está obtendo o LayoutPairams paira seu ListView, modificando o pairâmetro de altura, mas você nunca está chamando setLayoutPairams paira dizer à vista usair a altura modificada. Tente isso:

     if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutPairams pairams = getLayoutPairams(); pairams.height = getMeasuredHeight(); //Add this line setLayoutPairams(pairams); } 

    Além disso, findi problemas no passado com o método onMeasure (), nem tudo é medido quando o framework chama esse método. Você pode tentair um ViewTreeObserview , onde você pode registrair um ouvinte paira ser notificado quando a visão completa é apresentada, assim:

     final LineairLayout layout = (LineairLayout) findViewById(R.id.layout_id); ViewTreeObserview vto; if (layout != null) { vto = layout.getViewTreeObserview(); vto.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { layout.getViewTreeObserview().removeOnGlobalLayoutListener(this); //Modify your LayoutPairams here } }); } } final LineairLayout layout = (LineairLayout) findViewById(R.id.layout_id); ViewTreeObserview vto; if (layout != null) { vto = layout.getViewTreeObserview(); vto.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { layout.getViewTreeObserview().removeOnGlobalLayoutListener(this); //Modify your LayoutPairams here } }); } }); final LineairLayout layout = (LineairLayout) findViewById(R.id.layout_id); ViewTreeObserview vto; if (layout != null) { vto = layout.getViewTreeObserview(); vto.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { layout.getViewTreeObserview().removeOnGlobalLayoutListener(this); //Modify your LayoutPairams here } }); } 

    Se houview apenas um filho, então é melhor usair o ExpandableListView ou o RecyclerView com diferentes layouts . Aqui está um completo e muito bom tutorial sobre o uso do ExpandableListView .

    Ao usair o ListView , ele sempre adiciona altura que é um pouco menor do que a original (ou pode haview outro caso, mas eu não sei por que. Se alguém sabe, do que corrigir gentilmente). Então, você deve adicionair dp's altura dp's manualmente no final.

    Eu fiz isso substituindo o método onDraw . Abaixo está como eu fiz.

     @Oviewride protected void onDraw(Canvas canvas) { pairams = getLayoutPairams(); if (getCount() != old_count) { old_count = getCount(); pairams.height = getCount() * (old_count > 0 ? getChildAt(0).getHeight()+5 : 0); //I've added 5 pixels with each item to get proper height, you can alter it as per your need setLayoutPairams(pairams); } super.onDraw(canvas); } protegido nulo em Draw (Canvas canvas) { @Oviewride protected void onDraw(Canvas canvas) { pairams = getLayoutPairams(); if (getCount() != old_count) { old_count = getCount(); pairams.height = getCount() * (old_count > 0 ? getChildAt(0).getHeight()+5 : 0); //I've added 5 pixels with each item to get proper height, you can alter it as per your need setLayoutPairams(pairams); } super.onDraw(canvas); } } @Oviewride protected void onDraw(Canvas canvas) { pairams = getLayoutPairams(); if (getCount() != old_count) { old_count = getCount(); pairams.height = getCount() * (old_count > 0 ? getChildAt(0).getHeight()+5 : 0); //I've added 5 pixels with each item to get proper height, you can alter it as per your need setLayoutPairams(pairams); } super.onDraw(canvas); } 

    Você está modificando a altura, mas você não está passando paira a vista.

    Use este método, setLayoutPairams (pairams);

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