Merge "Fix bug 4021346 - crash while navigating" into honeycomb-mr1

This commit is contained in:
Adam Powell
2011-03-07 16:25:20 -08:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 5 deletions

View File

@@ -4275,11 +4275,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
* does not exist within the group
*/
public View getChildAt(int index) {
try {
return mChildren[index];
} catch (IndexOutOfBoundsException ex) {
if (index < 0 || index >= mChildrenCount) {
return null;
}
return mChildren[index];
}
/**

View File

@@ -3019,12 +3019,13 @@ public class ListView extends AbsListView {
hasOpaqueScrollbars()) || super.isOpaque();
if (retValue) {
// only return true if the list items cover the entire area of the view
final int listTop = mListPadding.top;
final int listTop = mListPadding != null ? mListPadding.top : mPaddingTop;
View first = getChildAt(0);
if (first == null || first.getTop() > listTop) {
return false;
}
final int listBottom = getHeight() - mListPadding.bottom;
final int listBottom = getHeight() -
(mListPadding != null ? mListPadding.bottom : mPaddingBottom);
View last = getChildAt(getChildCount() - 1);
if (last == null || last.getBottom() < listBottom) {
return false;