@@ -0,0 +1,3039 @@
+package com.monmonja.library.views;%0Aimport android.content.Context;%0Aimport android.content.res.Resources;%0Aimport android.database.DataSetObserver;%0Aimport android.util.AttributeSet;%0Aimport android.util.TypedValue;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0Aimport android.widget.LinearLayout;%0Aimport android.widget.ListAdapter;%0Aimport android.widget.TextView;%0A%0A/**%0A * http://stackoverflow.com/questions/3495890/how-can-i-put-a-listview-into-a-scrollview-without-it-collapsing%0A */%0Apublic class StretchedLinearLayout extends LinearLayout %7B%0A    private static final String TAG = %22StretchedListView%22;%0A    private final DataSetObserver mDataSetObserver;%0A    private ListAdapter mAdapter;%0A    private String mEmptyText = %22No data%22;%0A%0A%0A    public StretchedLinearLayout(Context context, AttributeSet attrs) %7B%0A        super(context, attrs);%0A        setOrientation(LinearLayout.VERTICAL);%0A        this.mDataSetObserver = new DataSetObserver() %7B%0A            @Override%0A            public void onChanged() %7B%0A                syncDataFromAdapter();%0A                super.onChanged();%0A            %7D%0A%0A            @Override%0A            public void onInvalidated() %7B%0A                syncDataFromAdapter();%0A                super.onInvalidated();%0A            %7D%0A        %7D;%0A    %7D%0A%0A    public String getEmptyText() %7B%0A        return mEmptyText;%0A    %7D%0A%0A    public void setEmptyText(String emptyText) %7B%0A        this.mEmptyText = emptyText;%0A    %7D%0A%0A    public void setEmptyText(int resId) %7B%0A        this.mEmptyText = getResources().getString(resId);%0A    %7D%0A%0A    public void setAdapter(ListAdapter adapter) %7B%0A        this.mAdapter = adapter;%0A        if (adapter != null) %7B%0A            this.mAdapter.registerDataSetObserver(mDataSetObserver);%0A        %7D else %7B%0A            this.mAdapter.unregisterDataSetObserver(mDataSetObserver);%0A        %7D%0A%0A        syncDataFromAdapter();%0A    %7D%0A%0A    public ListAdapter getAdapter() %7B%0A        return mAdapter;%0A    %7D%0A%0A    private void syncDataFromAdapter() %7B%0A        removeAllViews();%0A        if (mAdapter != null) %7B%0A            int count = mAdapter.getCount();%0A            if (count %3E 0) %7B%0A                for (int i = 0; i %3C count; i++) %7B%0A                    View view = mAdapter.getView(i, null, this);%0A                    addView(view);%0A                %7D%0A            %7D else %7B%0A                Resources r = getContext().getResources();%0A                int marginPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics());%0A%0A                TextView textView = new TextView(getContext());%0A                LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);%0A                layoutParams.leftMargin = marginPx;%0A                layoutParams.rightMargin = marginPx;%0A                textView.setLayoutParams(layoutParams);%0A                textView.setText(mEmptyText);%0A                addView(textView);%0A            %7D%0A        %7D%0A    %7D%0A%0A%0A    public int getCount() %7B%0A        return mAdapter != null ? mAdapter.getCount() : 0;%0A    %7D%0A%7D

Add StretchedLinearLayout