简体   繁体   中英

Android - list view and calendar view inside scroll view not showing all items

I have calendar view and list view inside scroll view.but all list items not showing. only one item is showing. please help me. thanks in advance.

Use this following on place of NonScrollListView

public class NonScrollListView extends ListView 
{

 public NonScrollListView(Context context) 
 {
    super(context);
 }
 public NonScrollListView(Context context, AttributeSet attrs) 
 {
    super(context, attrs);
 }
 public NonScrollListView(Context context, AttributeSet attrs, int defStyle) 
 {
    super(context, attrs, defStyle);
 }
 @Override
 public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) 
 {
    int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec(
            Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
    super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom);
    ViewGroup.LayoutParams params = getLayoutParams();
    params.height = getMeasuredHeight();
 }
}

<yourPackageName.NonScrollListView
                android:layout_width="match_parent"
                android:id="@+id/list_view"
                android:scrollbarStyle="outsideOverlay"
                android:layout_height="wrap_content"/>

It'll solve your issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM