How to Make Android ListView or GridView Expandable inside ScrollView

We all know that placing a ListView or GridView inside ScrollView will make them becoming difficult to scroll and can not be expanded. Android doesn't provide a built in API to handle this problem so we have to do a little hack by subclassing those two views.